papaface Posted October 9, 2007 Share Posted October 9, 2007 Hello, I have a string: "1034" How can I dynamically add the relevant commas so it would show up "1,034", and if it changes to "7854355" make it show "7,854,355"? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/72387-solved-add-commas-to-numbers-1034-1034/ Share on other sites More sharing options...
pocobueno1388 Posted October 9, 2007 Share Posted October 9, 2007 <?php $num = "16546981"; echo number_format($num); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72387-solved-add-commas-to-numbers-1034-1034/#findComment-365070 Share on other sites More sharing options...
papaface Posted October 9, 2007 Author Share Posted October 9, 2007 Ah ha Thanks Quote Link to comment https://forums.phpfreaks.com/topic/72387-solved-add-commas-to-numbers-1034-1034/#findComment-365071 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.