Is there a way to return any number WITH decimals, like 1 would return as 1.00 and 290 as 290.00 ?
Say I do
echo 5*10;
That returns 50, is there a way to return 50.00 ?
echo number_format(5*10, 2);
or
$number = 3*5; $number = number_format($number, 2);
As noted in this FAQ.
But... what if I don't know what FAQ means?
Originally posted by BuzzLY But... what if I don't know what FAQ means?
Someone with 490 posts under their belt hasn't seen it yet?
I tried using number_format() but It rounds the number up/down. I need the same number to stay, just with two decimal places after the number as well.
Originally posted by Weedpacket Someone with 490 posts under their belt hasn't seen it yet?
Sorry... forgot the :p
Originally posted by Sharif I tried using number_format() but It rounds the number up/down. I need the same number to stay, just with two decimal places after the number as well.
so concatenate .00 onto the number....
certainly not rocket science....
brain surgery maybe? 😕
Yes I would do that but sometimes numbers comeout as something like 24.98, adding .00 onto that is just plain dumb.
Originally posted by Sharif Yes I would do that but sometimes numbers comeout as something like 24.98, adding .00 onto that is just plain dumb.
Well then... dont say that you want...
if thats not what you want :rolleyes: thats just plain dumb
try reading this
printf('%.2f', 5*10);