3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $number = 3.0000000000000002; $precision = 8; $delta = 0.1 ** $precision; $rounded = round($number, $precision); if (abs($number -$rounded) < $delta) { $roundedResult = intval($number); } if ((int) $number == $number){ $intedResult = (int) $number; } echo "Rounded result: ".$roundedResult.PHP_EOL; echo "Inted result: ".$intedResult.PHP_EOL;
Output for 5.6.8 - 7.1.0
Rounded result: 3 Inted result: 3
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.5.35
Parse error: syntax error, unexpected '*' in /in/CeRde on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '*' in /in/CeRde on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/CeRde on line 8
Process exited with code 255.