Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/TextData.php
public static function DOLLAR($value = 0, $decimals = 2)
    {
        $value = Functions::flattenSingleValue($value);
        $decimals = $decimals === null ? 0 : Functions::flattenSingleValue($decimals);

        // Validate parameters
        if (!is_numeric($value) || !is_numeric($decimals)) {
            return Functions::NAN();
        }
        $decimals = floor($decimals);

        $mask = '$#,##0';
        if ($decimals > 0) {
            $mask .= '.' . str_repeat('0', $decimals);
        } else {
            $round = pow(10, abs($decimals));
            if ($value < 0) {
                $round = 0 - $round;
            }
            $value = MathTrig::MROUND($value, $round);
        }

        return NumberFormat::toFormattedString($value, $mask);
    }
public static function DOLLAR($value = 0, $decimals = 2)
    {
        $value = Functions::flattenSingleValue($value);
        $decimals = $decimals === null ? 0 : Functions::flattenSingleValue($decimals);

        // Validate parameters
        if (!is_numeric($value) || !is_numeric($decimals)) {
            return Functions::NAN();
        }
        $decimals = floor($decimals);

        $mask = '$#,##0';
        if ($decimals > 0) {
            $mask .= '.' . str_repeat('0', $decimals);
        } else {
            $round = pow(10, abs($decimals));
            if ($value < 0) {
                $round = 0 - $round;
            }
            $value = MathTrig::MROUND($value, $round);
        }

        return NumberFormat::toFormattedString($value, $mask);
    }
public static function DOLLAR ( $ value = 0 , $ decimals = 2 ) { $ value = Functions :: flattenSingleValue ( $ value ) ; $ decimals = $ decimals === null ? 0 : Functions :: flattenSingleValue ( $ decimals ) ; // Validate parameters if ( ! is_numeric ( $ value ) || ! is_numeric ( $ decimals ) ) { return Functions :: NAN ( ) ; } $ decimals = floor ( $ decimals ) ; $ mask = '$#,##0' ; if ( $ decimals > 0 ) { $ mask .= '.' . str_repeat ( '0' , $ decimals ) ; } else { $ round = pow ( 10 , abs ( $ decimals ) ) ; if ( $ value < 0 ) { $ round = 0 - $ round ; } $ value = MathTrig :: MROUND ( $ value , $ round ) ; } return NumberFormat :: toFormattedString ( $ value , $ mask ) ; }
DOLLAR.

This function converts a number to text using currency format, with the decimals rounded to the specified place.
The format used is $#,##0.00_);($#,##0.00)..

@param float $value The value to format
@param int $decimals The number of digits to display to the right of the decimal point.
If decimals is negative, number is rounded to the left of the decimal point.
If you omit decimals, it is assumed to be 2

@return string
DOLLAR .