...

View Full Version : Simple Question: How do add a decimal to a number. 300 to 3.00



mobimad
04-03-2010, 05:10 PM
How do add a decimal to a number so that 300 becomes 3.00

i can make it 300.00 but just cant find a way to make it 3.00

Thanks In-advance

Jenna

PappaJohn
04-03-2010, 05:18 PM
number-format() (http://us3.php.net/manual/en/function.number-format.php)

mobimad
04-03-2010, 05:23 PM
I've tried that but i cannot format the number 300 to 3.00

thanks
jenna

PappaJohn
04-03-2010, 05:28 PM
Apologies, I read your question wrong.



$number = 300/100;
echo number_format($number, 2); // echos 3.00



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum