如何在PHP中舍入数字? [重复]

Possible Duplicate:
Round up to nearest multiple of five in PHP

I have to round off numbers but not in the traditional way. I want to round to 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 and so on. After rounding, the rounded number should fall to one of the numbers listed above.

Is it possible?

Try this:

$rounded_value = round($original_value/5) * 5;

Or if always rounding down:

$rounded_value = floor($original_value/5) * 5;

Or if always rounding up:

$rounded_value = ceil($original_value/5) * 5;

Check out http://www.php.net/manual/en/function.round.php#32008

<?php 
// Rounding to the nearest fifth 
// or any other increment you wish... 

$percent = "48"; 
  $num = round($percent/5)*5; 
    echo $num; 
    // returns 50 

$percentt = "47"; 
  $numm = round($percentt/5)*5; 
    echo $numm; 
    // returns 45 
?>