I couldn't find any functions to do what ceiling does while still leaving I specified number of decimal places, so I wrote a couple functions myself. round_up is like ceil but allows you to specify a number of decimal places. round_out does the same, but rounds away from zero.
<?php
function round_up ($value, $places=0) {
if ($places < 0) { $places = 0; }
$mult = pow(10, $places);
return ceil($value * $mult) / $mult;
}
function round_out ($value, $places=0) {
if ($places < 0) { $places = 0; }
$mult = pow(10, $places);
return ($value >= 0 ? ceil($value * $mult):floor($value * $mult)) / $mult;
}
echo round_up (56.77001, 2); echo round_up (-0.453001, 4); echo round_out (56.77001, 2); echo round_out (-0.453001, 4); ?>