Number_format - format a number in thousands separators
String number_format ( float $number
[, int $decimals
= 0 ])
String
Number_format(Float
$number
, int
$decimals
= 0 , string
$dec_point
= "." , string
$thousands_sep
= "," )
This function can accept 1, 2, or 4 parameters (Note: cannot be 3):
If only the first argument is provided, number
the decimal section is removed and each thousand separator is the English lowercase comma ","
If you provide two parameters, the number
number of digits after the decimal point will be retained to the value you set, the rest of the same upstairs
If four parameters are supplied, the fractional number
part of the length is retained, the decimals
decimal point is replaced dec_point
with the thousand separator is thousands_sep
replaced by the
number
The number you want to format
decimals
The number of decimal digits to keep
dec_point
Specify the characters for the decimal point display
thousands_sep
Specify the characters that the thousands separator displays
$price = 12032.2395; $price 1=12032.568; Print Number_format ($price); out:12,032--Four print Number_format ($price 1); out:12,033-Five into print number_format ($price, ' 2 '); out:12,032.24 Print Number_format ($price, ' 2 ', '. ', ', ');//12,032.24
Number_format in PHP