in reply to Rounding to the nearest 50
Doesn't work on negative numbers between -49 and -1, but if you are dealing with currency or something, it doesn't matter. :) Working on the -49 to -1 range now.$x = 1; $y = int( $x / 50 ) * 50; if( $y == $x ){ print $x } else { print $y+50 };
|
|---|