PHP - Number: Formatting Numbers with CommasTag: number, number format, commas Category: PHP Application, PHP Basicpost: 16 Mar 2008 read: 202 PHP Number Tips - Part 3: If you want to make a large number readable by using commas between groups of thousands, you can use PHP's number_format( ) function such as:
The number_format( ) is a great tool to use in order to format large integer or floating-point numbers. Note that the output of the function is a string, not a number, and so it cannot be used for further numeric manipulation. If you have a floating-point number and don't want to round it up to an integer, you can pass number_format( ) a second argument which will control the number of decimals the formatted number should certain.
Furthermore, you can accomplish a custom decimal and/or thousands separator by passing number_format( ) two additional arguments. The first is for the decimal separator and the second is for the thousands separator. Here is the example beneath:
|
| | Give Your Opinion | Recommend |
|

