php money format with comma code example
Example 1: format php currency
<?php
$number = 1234.56;
$english_format_number = number_format($number);
$nombre_format_francais = number_format($number, 2, ',', ' ');
$number = 1234.5678;
$english_format_number = number_format($number, 2, '.', '');
Example 2: format money with commas in php
<?php
function CurrencyFormat($number)
{
$decimalplaces = 2;
$decimalcharacter = '.';
$thousandseparater = ',';
return number_format($number,$decimalplaces,$decimalcharacter,$thousandseparater);
}
?>