number_format() function is used to format numbers grouped by thousands.
number_format(num,decimals,decimal_pt,separator)
##num - The number to format.
decimals - Specifies the number of decimal places.
decimal_pt - String to use for the decimal point.
Separator - Specifies the string used for the thousands separator.
<?php echo number_format("10000000"); ?>
10,000,000
<?php echo number_format("3999.9, 2"); ?>
4,000
The above is the detailed content of number_format() function in PHP. For more information, please follow other related articles on the PHP Chinese website!