3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isEqual($a, $b, $epsilon = 1e-10) { if ( float($a) == float($b) ) // handles infinites return true; if ( (float)$a * (float)$b == 0 ) // a or b or both are zero return abs(float($a) - float($b)) < ( $epsilon * $epsilon ); return (abs(float($a) - float($b)) / (abs(float($a)) + abs(float($b)))) < $epsilon; } for ( $i = 0; $i < 10000; $i++ ) isEqual(0.000001, 0.000001);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function float() in /in/vBYP1:4 Stack trace: #0 /in/vBYP1(14): isEqual(1E-06, 1E-06) #1 {main} thrown in /in/vBYP1 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0
Fatal error: Call to undefined function float() in /in/vBYP1 on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: float() in /in/vBYP1 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: float() in /in/vBYP1 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: float() in /in/vBYP1 on line 4