3v4l.org

run code in 300+ PHP versions simultaneously
<?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'); 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 git.master, git.master_jit, rfc.property-hooks
Warning: include(): open_basedir restriction in effect. File(pyhp.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/IhZ9N on line 3 Warning: include(pyhp.php): Failed to open stream: Operation not permitted in /in/IhZ9N on line 3 Warning: include(): Failed opening 'pyhp.php' for inclusion (include_path='.:') in /in/IhZ9N on line 3 Fatal error: Uncaught Error: Call to undefined function pyrange() in /in/IhZ9N:28 Stack trace: #0 {main} thrown in /in/IhZ9N on line 28
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.43 ms | 402 KiB | 8 Q