3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a=0; $b=0; $c=0; $determinant = $b * $b - 4 * ($a * $c) ; // D = b² - 4ac echo "d = $determinant\n"; // x1 = (-b + Rac(D)) / 2a et x2 = (-b – Rac(D)) /2a if ($determinant > 0){ $x1 = (-$b + sqrt($determinant))/ 2 * $a; $x2 = (-$b - sqrt($determinant))/ 2 * $a; echo "x1 = $x1\n"; echo "x2 = $x2\n"; } if ($determinant == 0){ $x1 = $x2 = -$b/ (2 * $a); echo "x1 = $x1\n"; echo "x2 = $x2\n"; }
based on BIRSt
Output for 7.0.0 - 7.2.0
d = 0 Warning: Division by zero in /in/J2jp8 on line 26 x1 = NAN x2 = NAN
Output for 5.3.20 - 5.6.28
d = 0 Warning: Division by zero in /in/J2jp8 on line 26 x1 = x2 =