On Friday 21 February 2003 05:17, Van Andel, Robbert wrote:
> How do I round a number to the nearest 10 or even 5.  Say I have a
> number like 12.  Is there an easy way to round that up to 15 or 20?

To round to the nearest 5:

  Divide by 5
  Round to the nearest integer
  Multiply by 5

I'll leave you to work out how to round to nearest 10.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Man belongs wherever he wants to go.
                -- Wernher von Braun
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to