public function numberToString($var) : string
    {
        static $precision;
        if (!$precision) {
            $precision = pow(10, (int)ini_get('precision'));
        }
        $v = '' . $var;
        if (!is_numeric($v)) {
            throw new \InvalidArgumentException('Arg var is not integer/float nor number-like when stringified.');
        }

        // If within system precision, just string it.
        return ($v > -$precision && $v < $precision) ? $v : number_format((float) $v, 0, '.', '');
    }
public function numberToString($var) : string
    {
        static $precision;
        if (!$precision) {
            $precision = pow(10, (int)ini_get('precision'));
        }
        $v = '' . $var;
        if (!is_numeric($v)) {
            throw new \InvalidArgumentException('Arg var is not integer/float nor number-like when stringified.');
        }

        // If within system precision, just string it.
        return ($v > -$precision && $v < $precision) ? $v : number_format((float) $v, 0, '.', '');
    }
public function numberToString ( $ var ) : string { static $ precision ; if ( ! $ precision ) { $ precision = pow ( 10 , ( int ) ini_get ( 'precision' ) ) ; } $ v = '' . $ var ; if ( ! is_numeric ( $ v ) ) { throw new \ InvalidArgumentException ( 'Arg var is not integer/float nor number-like when stringified.' ) ; } // If within system precision, just string it. return ( $ v > - $ precision && $ v < $ precision ) ? $ v : number_format ( ( float ) $ v , 0 , '.' , '' ) ; }
Convert number to string avoiding E-notation for numbers outside system
precision range.

@param mixed $var
Gets stringified.

@return string

@throws \InvalidArgumentException
If arg var isn't integer/float nor number-like when stringified.
Convert number to string avoiding E - notation for numbers outside system precision range .