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!
![]() Questions about learn PHP:
|
|