February 2013
Intermediate to advanced
538 pages
20h 55m
English
number_format
string number_format(floatnumber[, intprecision[, stringdecimal_separator, stringthousands_separator]])
Creates a string representation of
number. If
precision is given, the number is rounded
to that many decimal places; the default is no decimal places,
creating an integer. If decimal_separator
and thousands_separator are provided, they
are used as the decimal-place character and thousands separator,
respectively. They default to the English locale versions (. and ,).
For example:
$number=7123.456;$english=number_format($number,2);// 7,123.45$francais=number_format($number,2,',',' ');// 7 123,45$deutsche=number_format($number,2,',','.');// 7.123,45
If rounding occurs, proper rounding is performed, which may not
be what you expect (see round).
Read now
Unlock full access