Something like this...?

if( $n % 100 != 0 )  {
  $n += 100 - ($n % 100);
}

Although I don't think your example is any messier...  maybe ceil/floor
should have a precision field added...

-philip

On Fri, 8 Feb 2002, Charlie Killian wrote:

> For an arbitrary large number I need to round() it up to the hundreds place
> if it is not divisible by 100 and leave it untouched if it is.
>
> So 1100 would round to 1100 and
> 1101 would round to 1200.
>
> Is there a clean way to do this?
>
> Currently I'm:
> $scale = round($scale+49, -2); // round up to hundreds.
>
> But this is messy.
>
> Charlie
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to