9

I'm using on money_format with the first parameter being '%n' to include the dollar sign, and I have the locale set to en_US but it still doesn't include it. Why?

codaddict
  • 445,704
  • 82
  • 492
  • 529

1 Answers1

22

From the PHP.net comment:

If money_format doesn't seem to be working properly, make sure you are defining a valid locale. For example, on Debian, 'en_US' is not a valid locale - you need 'en_US.UTF-8' or 'en_US.ISO-8559-1'.

This was frustrating me for a while. Debian has a list of valid locales at /usr/share/i18n/SUPPORTED; find yours there if it's not working properly.

codaddict
  • 445,704
  • 82
  • 492
  • 529
  • That sounds like it'll fix it. It's running on a Ubuntu server, and thats why the servers at work, work. They're running redhat. Thanks! I'll try it when i get home. –  Nov 18 '10 at 21:47
  • That's a pretty interesting little caveat to the php Debian installs out there. – Mark Tomlin Nov 19 '10 at 02:53
  • This just saved me so much time of debugging. If you have a debian/ubuntu you need to check that you are using the valid locale. – jdwfly Feb 23 '11 at 00:45
  • 1
    To see the list of valid locales on the server, we can run this command `locale -a`. It's still possible that we can use ` – bobo Oct 21 '11 at 19:32