Eiolon Posted October 26, 2010 Share Posted October 26, 2010 If I put this in a new HTML document: <?php $number = 1234.56; // let's print the international format for the en_US locale setlocale(LC_MONETARY, 'en_US'); echo money_format('%i', $number) . "\n"; // USD 1,234.56 ?> as per the PHP manual, I get: Fatal error: Call to undefined function money_format() in C:\wamp\www\accounts\test.php on line 7 Line 7 is: echo money_format('%i', $number) . "\n"; I have tried setting different locales and same result. Any ideas on what I need to do to get it to work? Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/ Share on other sites More sharing options...
Pikachu2000 Posted October 26, 2010 Share Posted October 26, 2010 Check the php manual and make sure the version of php you're using supports the money_format() function. As I recall, it was added in a fairly recent version. Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/#findComment-1126781 Share on other sites More sharing options...
Eiolon Posted October 26, 2010 Author Share Posted October 26, 2010 I am using PHP 5.3.0. From the manual: (PHP 4 >= 4.3.0, PHP 5). Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/#findComment-1126788 Share on other sites More sharing options...
BlueSkyIS Posted October 26, 2010 Share Posted October 26, 2010 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. Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/#findComment-1126793 Share on other sites More sharing options...
Pikachu2000 Posted October 26, 2010 Share Posted October 26, 2010 Jeez, I was thinking it came in around 5.1 or so . . . Anyhow, just noticed you're on WinD'ohs. From the manual also: Note: 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. Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/#findComment-1126795 Share on other sites More sharing options...
Eiolon Posted October 26, 2010 Author Share Posted October 26, 2010 Alright, I guess I'll just use number_format. Thanks. Link to comment https://forums.phpfreaks.com/topic/216904-cant-get-money_format-to-work/#findComment-1126814 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.