PHP number format without comma

number_format() takes additional parameters:

number_format(1000.5, 2, '.', '');

The default is a period (.) for the decimal separator and a comma (,) for the thousands separator. I'd encourage you to read the documentation.


See the documentation for number_format: http://php.net/number_format

The functions parameters are:

string number_format ( float $number , int $decimals = 0 , string $dec_point = '.' , string $thousands_sep = ',' )

So use:

number_format(1000.5, 2, '.', '');

Which means that you don't use any (= empty string) thousands separator, only a decimal point.


The documentation of number_format contains information about the parameter string $thousands_sep = ','. So this should work:

number_format(1000.5, 2, '.', '');

number_format(1000.5, 2, '.', '');

http://php.net/manual/en/function.number-format.php

Tags:

Php