I'm not sure how to tackle this and i've searched through the php functions.
I'm trying to get a number displayed to the nearest 2 decial places so 0.01.
Now, most of the time the trailing digits are zeros, so i tried round($number,2) that didnt work...
and i also tried floor but that didnt do anything either. I tried casting the type to float, and still no effect,
and i also searched and tried round($number/0.01)*0.01 with no effect, i'm guessing the 0's are causing some issues here, is there a way to set the precision of a number? Thank you!
Establishing precision of a number..
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
if the trailing digits are zeros they aren't printed by php because it's not a logical display format.
sprintf('%.2f',round($num,2))
sprintf('%.2f',round($num,2))