in reply to •Re: Re: rounding to nearest integer
in thread rounding to nearest integer
I supposed you could get the int() method to work on negatives by using abs() and some arithmetic with it.
if ( $value < 0 ) { $rounded = ( int( abs($value) + 0.5) ); $rounded = $rounded - ( $rounded * 2 ); } else { $rounded = int($value + 0.5) }
or something...
Seems more complicated than sprintf() =)
--
Allolex
Update: Added closing bracket. (2003-05-15 19:27:26 CEST)
|
|---|