3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php for ($x=1;$x<24;$x++) { var_dump($x / 2); var_dump(round($x /2),1,PHP_ROUND_HALF_UP);}
based on eESA9
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
float(0.5) float(1) int(1) int(1) int(1) float(1) int(1) int(1) float(1.5) float(2) int(1) int(1) int(2) float(2) int(1) int(1) float(2.5) float(3) int(1) int(1) int(3) float(3) int(1) int(1) float(3.5) float(4) int(1) int(1) int(4) float(4) int(1) int(1) float(4.5) float(5) int(1) int(1) int(5) float(5) int(1) int(1) float(5.5) float(6) int(1) int(1) int(6) float(6) int(1) int(1) float(6.5) float(7) int(1) int(1) int(7) float(7) int(1) int(1) float(7.5) float(8) int(1) int(1) int(8) float(8) int(1) int(1) float(8.5) float(9) int(1) int(1) int(9) float(9) int(1) int(1) float(9.5) float(10) int(1) int(1) int(10) float(10) int(1) int(1) float(10.5) float(11) int(1) int(1) int(11) float(11) int(1) int(1) float(11.5) float(12) int(1) int(1)
Output for 4.3.0 - 5.2.17
float(0.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(1) int(1) string(17) "PHP_ROUND_HALF_UP" int(1) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(1) int(1) string(17) "PHP_ROUND_HALF_UP" float(1.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(2) int(1) string(17) "PHP_ROUND_HALF_UP" int(2) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(2) int(1) string(17) "PHP_ROUND_HALF_UP" float(2.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(3) int(1) string(17) "PHP_ROUND_HALF_UP" int(3) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(3) int(1) string(17) "PHP_ROUND_HALF_UP" float(3.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(4) int(1) string(17) "PHP_ROUND_HALF_UP" int(4) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(4) int(1) string(17) "PHP_ROUND_HALF_UP" float(4.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(5) int(1) string(17) "PHP_ROUND_HALF_UP" int(5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(5) int(1) string(17) "PHP_ROUND_HALF_UP" float(5.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(6) int(1) string(17) "PHP_ROUND_HALF_UP" int(6) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(6) int(1) string(17) "PHP_ROUND_HALF_UP" float(6.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(7) int(1) string(17) "PHP_ROUND_HALF_UP" int(7) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(7) int(1) string(17) "PHP_ROUND_HALF_UP" float(7.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(8) int(1) string(17) "PHP_ROUND_HALF_UP" int(8) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(8) int(1) string(17) "PHP_ROUND_HALF_UP" float(8.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(9) int(1) string(17) "PHP_ROUND_HALF_UP" int(9) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(9) int(1) string(17) "PHP_ROUND_HALF_UP" float(9.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(10) int(1) string(17) "PHP_ROUND_HALF_UP" int(10) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(10) int(1) string(17) "PHP_ROUND_HALF_UP" float(10.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(11) int(1) string(17) "PHP_ROUND_HALF_UP" int(11) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(11) int(1) string(17) "PHP_ROUND_HALF_UP" float(11.5) Notice: Use of undefined constant PHP_ROUND_HALF_UP - assumed 'PHP_ROUND_HALF_UP' in /in/XnSnU on line 5 float(12) int(1) string(17) "PHP_ROUND_HALF_UP"