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'); 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); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.190.0320.05812.41
5.4.180.0140.04512.41
5.4.170.0140.04512.41
5.4.160.0140.04512.41
5.4.150.0180.04312.41
5.4.140.0190.03912.10
5.4.130.0140.04412.08
5.4.120.0220.06612.04
5.4.110.0160.04212.04
5.4.100.0150.04312.04
5.4.90.0160.04212.04
5.4.80.0180.03912.04
5.4.70.0170.04212.04
5.4.60.0140.04412.04
5.4.50.0180.03912.04
5.4.40.0120.04512.02
5.4.30.0190.04012.02
5.4.20.0140.04312.02
5.4.10.0150.04212.02
5.4.00.0130.04311.51
5.3.270.0170.04312.72
5.3.260.0160.05912.72
5.3.250.0150.04612.72
5.3.240.0100.05012.72
5.3.230.0170.04312.71
5.3.220.0170.04312.68
5.3.210.0200.05612.68
5.3.200.0150.04312.68
5.3.190.0130.04712.68
5.3.180.0170.04212.67
5.3.170.0130.04612.67
5.3.160.0200.05412.67
5.3.150.0180.04112.67
5.3.140.0180.04312.66
5.3.130.0160.04412.66
5.3.120.0170.04312.66
5.3.110.0130.04712.66
5.3.100.0120.04812.14
5.3.90.0200.05312.12
5.3.80.0170.04312.11
5.3.70.0170.05712.11
5.3.60.0250.06512.10
5.3.50.0130.04612.04
5.3.40.0160.04412.04
5.3.30.0210.03712.01
5.3.20.0270.07611.78
5.3.10.0190.03811.75
5.3.00.0210.03611.73

preferences:
140.24 ms | 1394 KiB | 7 Q