3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function mround($number, $precision=0) { $precision = ($precision == 0 ? 1 : $precision); $pow = pow(10, $precision); $ceil = ceil($number * $pow)/$pow; $floor = floor($number * $pow)/$pow; $pow = pow(10, $precision+1); $diffCeil = $pow*($ceil-$number); $diffFloor = $pow*($number-$floor)+($number < 0 ? -1 : 1); if($diffCeil >= $diffFloor) return $floor; else return $ceil; } echo mround(4.725, 2); // Yes 4.73
Output for 4.3.0 - 5.0.5, 5.1.1 - 7.1.0
4.73
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/mWMo8 on line 19
Process exited with code 255.