2

I am trying to convert a numeric string to Indian Number System (Lakhs format) and for this I googled and tried the following code.

This code part gave me correct output when tested in a linux shared hosting server, but it is not working in windows shared hosting, not sure if this is due to some version problem, any clue if there is any alternative to setlocate?

$amount = '120090';
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!i', $amount);
print $amount;
rray
  • 2,518
  • 1
  • 28
  • 38
krishna89
  • 850
  • 1
  • 19
  • 42

1 Answers1

5

This function does not work at windows, the doc says:

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.

One alternative is intl(you need enable via php.ini) library and numberFormatter class see the example:

Print Currency Number Format in PHP

Community
  • 1
  • 1
rray
  • 2,518
  • 1
  • 28
  • 38