To set the format of numbers in PHP, you can use the function number_format. You can set the pattern, separator of the decimal point and separator of thousands by using this function.


$number = 12345.67;
// The default pattern
echo number_format($number) . "<br>";
// Output: 12,346

// Set the number of decimals
echo number_format($number,4) . "<br>";
// Output: 12,345.6700

// Set the separator for deciaml points as command
// Set the separator for thousands as space
echo number_format($number,4,',', ' ') . "<br>";
// Output: 12 345,6700