Re: Round to a given value?
| From: | Ashley Sheridan | Date: | Wed, 24 Dec 2008 20:09:36 +0000 |
| Subject: | Re: Round to a given value? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285059@lists.php.net to get a copy of this message | ||
On Wed, 2008-12-24 at 20:38 +0100, Anders Norrbring wrote:
> Rounding an integer to the closest divisor by ten is easy with round() and a
> negative precision, but I turn out to be lost if I want to round to a given
> number..
>
> Example, round to the closest 5000, or closest 400? Any great ideas?
>
> Thanks, and merry x-mas!
> Anders.
>
>
>
http://www.alixaxel.com/wordpress/wp-content/2008/05/Round.php
Someone was way ahead of you and found the answer and posted on the PHP
manual pages back in May. The manual pages are always useful, even if
only for the user-written functions!
Ash
www.ashleysheridan.co.uk