Craig Keightley <do**@spam.me> wrote:
Is there a way to "round" (bad use of the word) a number to the nearest 5
eg
4 => 5
7 => 10
1 => 5
12 => 15
Many Thanks for any help provide
Craig
$round_x = 5 * ceil($x/5);
or (*maybe* faster):
$round_x = $x + ((5 - ($x%5)) % 5);
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle