...Beauty, cleaning, DIY tips and more - free to join!
   Login   Contact us   Site map   Puzzle Club   Ask a question    Newsletter

How To Format Numbers In PHP

Computing : Learning PHP

If you want to take numbers in and out of a database, from a file or anywhere else, you will often need to store them without commas.

Thus a salary figure in an INT field in a database will need just the numbers.

To format numbers can be tricky to work out though not entirely difficult.

However PHP has a helper function to insert the commas at just the right places.

The function is simple: number_format

Thus $formatted = number_format(1000000);

will give: 1,000,000. Just what we need!


By: Stephen

Share on Facebook: On Twitter: TwitterTweet this!

  Reply to How To Format Numbers In PHP

  Receive Our Newsletter




Questions about learn PHP:

Ask question

More Articles:
How to download Opera
How to Synchronize Your Computer Clock with an Internet Time Server
How to FTP for free