3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?PHP include 'pyhp.php'; if (!function_exists('gmp_sign')) { function gmp_sign($x) { return ($x<0?-1:1); } } function assertx($assertion, $failure="Assertion failed", $throwexception=true, $exception="ErrorException") { $assert_options = array(ASSERT_WARNING => 0, ASSERT_BAIL => 0, ASSERT_QUIET_EVAL => 1); foreach ($assert_options as $opt => $val) { $origval = assert_options($opt, $val); $assert_options[$opt] = $origval; } $test = assert($assertion); foreach ($assert_options as $opt => $val) { assert_options($opt, $val); } if ($test) return true; if (!$test) { if ($throwexception) throw new $exception($failure); return false; } } $xr = pyrange(-1, 1, 0.1); $yr = pyrange(-1, 1, 0.2); $eq = function($x, $y) { $c = function($i) { return $i*(180/pi()); }; $x = $c($x); $y = $c($y); if ($y == 0) return 90*gmp_sign($x); $a = round(180-$c(atan($x/$y)),0); if (gmp_sign($y) == -1) { $a -= 180; } return $a; }; assertx(gmp_sign(-0.5).'==-1'); assertx($eq(1, 1).'==135'); assertx($eq(-1 , echo $eq(1, 1); echo PHP_EOL; echo $eq(-1, 1); echo PHP_EOL; echo $eq(-1, -1); echo PHP_EOL; echo $eq(1, -1); ?>
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /in/B0J97 on line 45
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_ECHO in /in/B0J97 on line 45
Process exited with code 255.