Hi
Could any1 help me with an easy way to round an amount from 100.90 to 101.00
I must have the last to decimals to be .00
Thanks in advance
Tom
$newnum = explode("." $num); if($newnum[1] < 50) { $newnum[0]++ ; echo $newnum[0] . ".00"; } else { echo $newnum[0] . ".00"; }
I am sure there is a better way but that is what I would do.
number_format($num, 2);
I mean:
$num = "101.50"; $newnum = ROUND($num); print number_format($newnum, 2);
Look at floor() ceil() round() number_format().
If the other's suggested it, pardon the repeat.