PC Nerd Posted August 7, 2007 Share Posted August 7, 2007 Hi, If i have $Money = 200000; Then how can i get it to automatically place "," within that number, to convert it to a string? I can easily add "$" etc. but im stumped on this "," buisness. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/63676-formatting-currencies-from-an-int/ Share on other sites More sharing options...
Daniel0 Posted August 7, 2007 Share Posted August 7, 2007 number_format() Quote Link to comment https://forums.phpfreaks.com/topic/63676-formatting-currencies-from-an-int/#findComment-317341 Share on other sites More sharing options...
sasa Posted August 7, 2007 Share Posted August 7, 2007 try <?php $a = 1000; echo '$ ', number_format($a, 2, '.', ','); ?> Quote Link to comment https://forums.phpfreaks.com/topic/63676-formatting-currencies-from-an-int/#findComment-317342 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.