PHP Rounding Question
| From: | Rick Dwyer | Date: | Fri, 20 May 2011 17:40:38 +0000 |
| Subject: | PHP Rounding Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312981@lists.php.net to get a copy of this message | ||
I have a division formula that will return an value from 0.00 to 5... so I can get values like 2.38 or 4.79.
However, never lower than 0 or higher than 5.
How do I coerce the result to always round up to the nearest increment 1/4? So for example:
2.06 gets rounded to 2.25
0.01 gets rounded to 0.25
4.28 gets rounded to 4.50
3.71 gets rounded to 3.75
Thanks,
--Rick