number_format

string number_format(float num, [int places], [string decimal_separator], 
 [string thousands_separator]) 

Returns the formatted string representation of the value according to the format specified.

Returns:

Formatted number as a string

Description:

This function returns a string representation of the value given by num . This string has places decimal places, the decimal separator (radix) is decimal_separator , and the thousands separator is thousands_separator . This can be useful for printing numeric values intended for audiences in different locales or countries.

If you supply decimal_separator , you must also supply thousands_separator .

The default formatting is US/British. The default value for decimal_separator is, (a single ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.