Php Tutorial: PHP number_format () instance tutorial
Definition and usage
The number_format () function is formatted with thousands of groups.
Syntax
Number_format (number, decimals, decimalpoint, separator)
| Number | Required. Number to format. If no other parameter settings are available, separate decimal places with commas (,) as thousands. |
| Decimals | Optional. Number of decimal places. If the number set by this parameter is formatted as a vertex (. ) As the decimal point. |
| Decimalpoint | Optional. Specify the decimal point to be used. |
| Separator | Optional. Which string specifies the thousands separator to use. Only the first character is separated. For example, "XXX" will give the same output as "X ". Note: If this parameter is set, all other parameters are required. |
Tips and instructions
Note: This function supports one, two, or four parameters (instead of three ).
For example
<? Phpecho number_format ("1000000"); echo "<br/>"; echo number_format ("1000000", 2); echo "<br/> "; echo number_format ("1000000", 2 ,",",". ");?>
Result.
1,000,000, 000, 000.001.000.000, 00