I am trying to format my number in the following way
12,34,56,789.00
i tried
number_format($row{'money'},2,".",",")
I am getting
123,456,789.00
This is not what i wanted. So, How to do this?? (12,34,56,789.00
)
I am trying to format my number in the following way
12,34,56,789.00
i tried
number_format($row{'money'},2,".",",")
I am getting
123,456,789.00
This is not what i wanted. So, How to do this?? (12,34,56,789.00
)
You can do this just by using the PHP function called money_format
$amount = '123456789.00';
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!i', $amount);
echo $amount; // 12,34,56,789.00
The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.
So you can use this php code:
setlocale(LC_ALL, ''); // Locale will be different on each system.
$amount = 123456789.00;
$locale = localeconv();
echo number_format($amount, 2, $locale['decimal_point'], $locale['thousands_sep']);