number_format() function formats a number with grouped thousands.
Syntax
number_format( number, decimals, decimalpoint, separator)
<?php
echo number_format(“1000000”); // output 1,000,000
echo number_format(“1000000”,2); // output 1,000,000.00
echo number_format(“1000000”,2,“,”,“,”); // output 1,000,000,00
?>