I need to change the format of the numbers on a page.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

I need to change the format of the numbers on a page.

Post by amir »

Hello,

I need to change the format of the numbers on a page.

for example if the result of a calculation is 3.9 I need to show it as 03.90

23.1 ---> 23.10
0.08 ---> 00.08

and so on.

Any kind of help is much appreciated
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

look into these...

Code: Select all

ini_set('precision', 2) // http://php.net/manual/en/ini.core.php#ini.precision
number_format()
money_format()
round()
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Or sprintf().
Post Reply