Warning: money_format does not work on Windows

Folks,

PHP logoI am certain you are far cleverer than I. I spent a couple of hours attempting to do some development with PHP function money_format(), and it did not work.

I wanted to use money_format() to convert a number formatted for currency. But, I wanted it function for development and for site.

I scratched my head over and over … leaving dandruff everywhere. After some reflection, and then search of the internet and reading the PHP documentation for money_format over and over … it dawned on me that the documentation said it does not work on a Windows system. I develop on a Windows system running Apache, and load to a server running Linux. Don’t use money_format if you develop on Windows … if you want to see function on your development environment.

Use number_format(), this works on both Windows and Linux. Much better.

Oh, and the currency symbol can be identified using localconv(), which returns an array with [currency_symbol].

Leave a Reply