frank_solo Posted May 24, 2013 Share Posted May 24, 2013 I'm already using number_format() it shows the commas but for a number like 1500.53 the 1500 becomes 1,500 but the .53 disappears. Is there a better way? Quote Link to comment https://forums.phpfreaks.com/topic/278354-formatting-numbers-to-show-commas-and-decimal-points/ Share on other sites More sharing options...
Love2c0de Posted May 24, 2013 Share Posted May 24, 2013 Good afternoon, Try this code: $number = 1234.56; $english_format_number = number_format($number, 2, '.', ','); print($english_format_number); Read this page here: http://php.net/manual/en/function.number-format.php Kind regards, L2c. Quote Link to comment https://forums.phpfreaks.com/topic/278354-formatting-numbers-to-show-commas-and-decimal-points/#findComment-1432090 Share on other sites More sharing options...
Solution frank_solo Posted May 24, 2013 Author Solution Share Posted May 24, 2013 Yup that did the trick, Thanks Love2code Quote Link to comment https://forums.phpfreaks.com/topic/278354-formatting-numbers-to-show-commas-and-decimal-points/#findComment-1432092 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.