I have this code
I want to round two decimals to half up, I expect a value as 0.58... but
function round_up($value, $places) { $mult = pow(10, abs($places)); return $places < 0 ? ceil($value / $mult) * $mult : ceil($value * $mult) / $mult; } echo round_up(0.572,2);
Hope this will work for you!!