CodeIgniter Forums
How to insert comas into a number? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: How to insert comas into a number? (/thread-10539.html)



How to insert comas into a number? - El Forum - 08-04-2008

[eluser]daulex[/eluser]
(I need this for an old project that is not based on CI)

I have no clue how to do this.

The system: The user can type in a number, after numerous formulas and functions it changes and gets displayed on a different page, where it shows up like

10000 or 200 or 6020400 or any number for that matter, I would need numbers that are over 3 digits long to be parsed, so instead of 1000 it would show 1,000 or 1,000 and instead of for example 9284155213 it would show 9,284,155,213.

I hope you get the idea... Does anyone know any easy way to do this? (I don't really mind if it's php or javascript...)


Thanks Smile


How to insert comas into a number? - El Forum - 08-04-2008

[eluser]xwero[/eluser]
you can use the php number_format function to do what you want.