3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decorate(callable $fn, callable $decorator) { $wrapper = $decorator($fn); return function() use ($wrapper) { return call_user_func_array($wrapper, func_get_args()); }; } function foo($bar) { throw new Exception("Error $bar!"); } function catch_all_exceptions(callable $fn) { return function() use ($fn) { try { return call_user_func_array($fn, func_get_args()); } catch (\Exception $e) { echo "catch_all_exceptions: Caught Exception: $e\n"; } }; } function once(callable $fn) { return function() use ($fn) { static $return; static $called = false; if (!$called) { $return = call_user_func_array($fn, func_get_args()); $called = true; } return $return; }; } function do_something_before(callable $fn) { return function() use ($fn) { echo "Before!\n"; return call_user_func_array($fn, func_get_args()); }; } $bar = decorate(function() { echo "Hello\n"; }, "once"); $bar(); $bar(); $bar(); $foo = decorate(decorate("foo", "catch_all_exceptions"), "do_something_before"); var_dump($foo("bar"));

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)
8.3.60.0100.00318.06
8.3.50.0100.00521.02
8.3.40.0120.00318.70
8.3.30.0100.00320.39
8.3.20.0000.00720.29
8.3.10.0070.00321.96
8.3.00.0040.00422.51
8.2.180.0060.01318.29
8.2.170.0170.00322.96
8.2.160.0000.01322.11
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00820.73
8.2.110.0090.00019.27
8.2.100.0060.00617.78
8.2.90.0000.00919.22
8.2.80.0080.00017.97
8.2.70.0000.00917.50
8.2.60.0030.00618.03
8.2.50.0000.00818.07
8.2.40.0050.00318.21
8.2.30.0040.00419.43
8.2.20.0000.00717.56
8.2.10.0040.00417.89
8.2.00.0030.00917.85
8.1.280.0070.00725.92
8.1.270.0030.00523.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00622.59
8.1.230.0000.01120.88
8.1.220.0080.00018.77
8.1.210.0000.00819.08
8.1.200.0030.00717.23
8.1.190.0030.00517.39
8.1.180.0030.00618.10
8.1.170.0000.00918.59
8.1.160.0040.00418.80
8.1.150.0040.00418.65
8.1.140.0040.00417.36
8.1.130.0000.00717.84
8.1.120.0000.00717.44
8.1.110.0000.00817.54
8.1.100.0040.00417.36
8.1.90.0000.00717.45
8.1.80.0040.00317.45
8.1.70.0060.00317.36
8.1.60.0030.00617.65
8.1.50.0040.00717.55
8.1.40.0030.00517.45
8.1.30.0040.00417.64
8.1.20.0030.00617.63
8.1.10.0040.00417.50
8.1.00.0060.00317.56
8.0.300.0040.00420.02
8.0.290.0040.00417.18
8.0.280.0000.00718.47
8.0.270.0000.00817.18
8.0.260.0080.00016.88
8.0.250.0000.00716.93
8.0.240.0060.00317.02
8.0.230.0030.00317.06
8.0.220.0040.00416.93
8.0.210.0000.00716.93
8.0.200.0000.00617.04
8.0.190.0030.00316.93
8.0.180.0000.00817.02
8.0.170.0030.00616.82
8.0.160.0030.00317.02
8.0.150.0000.00816.80
8.0.140.0000.00716.82
8.0.130.0050.00013.36
8.0.120.0040.00416.76
8.0.110.0030.00517.01
8.0.100.0000.00816.78
8.0.90.0000.00716.92
8.0.80.0130.00316.99
8.0.70.0000.00716.93
8.0.60.0000.00716.95
8.0.50.0050.00216.86
8.0.30.0130.00617.10
8.0.20.0080.01317.43
8.0.10.0030.00517.20
8.0.00.0100.00716.62
7.4.330.0030.00315.06
7.4.320.0000.00716.44
7.4.300.0000.00616.53
7.4.290.0040.00416.67
7.4.280.0050.00216.64
7.4.270.0030.00316.54
7.4.260.0020.00213.25
7.4.250.0000.00816.49
7.4.240.0030.00316.53
7.4.230.0000.00716.27
7.4.220.0120.00616.52
7.4.210.0070.00816.60
7.4.200.0000.00716.68
7.4.190.0030.00316.65
7.4.160.0090.00616.43
7.4.150.0090.00917.40
7.4.140.0080.01217.86
7.4.130.0030.01316.62
7.4.120.0130.00616.58
7.4.110.0110.00616.55
7.4.100.0140.00716.44
7.4.90.0160.00016.56
7.4.80.0030.01419.39
7.4.70.0070.01016.51
7.4.60.0100.00616.62
7.4.50.0040.00416.40
7.4.40.0040.01122.77
7.4.30.0070.01016.58
7.4.00.0060.01014.84
7.3.330.0000.00513.47
7.3.320.0080.00013.44
7.3.310.0030.00316.26
7.3.300.0030.00316.44
7.3.290.0060.00916.36
7.3.280.0100.00816.49
7.3.270.0090.00917.40
7.3.260.0130.00516.40
7.3.250.0160.00316.74
7.3.240.0070.01016.51
7.3.230.0060.01216.50
7.3.210.0060.01116.48
7.3.200.0070.01119.39
7.3.190.0080.01116.70
7.3.180.0070.01016.36
7.3.170.0090.00616.63
7.3.160.0030.01316.38
7.3.120.0100.00615.02
7.2.330.0070.01216.90
7.2.320.0040.01316.40
7.2.310.0090.00816.52
7.2.300.0070.01116.54
7.2.290.0130.00316.56
7.2.60.0030.01316.91
7.1.200.0030.00615.79
7.1.100.0110.00017.93
7.1.70.0050.00317.24
7.1.60.0040.01219.21
7.1.50.0180.01534.96
7.1.00.0070.04022.54
7.0.200.0000.00716.82
7.0.140.0100.06722.09
7.0.70.0070.08021.65
7.0.60.0070.06321.77
7.0.50.0070.08321.96
7.0.40.0030.08020.04
7.0.30.0000.06020.14
7.0.20.0100.08320.14
7.0.10.0030.08020.07
7.0.00.0030.05020.14
5.6.280.0070.07321.07
5.6.220.0030.08020.68
5.6.210.0070.07720.64
5.6.200.0070.07721.07
5.6.190.0100.08020.96
5.6.180.0070.07321.08
5.6.170.0030.07720.99
5.6.160.0070.07021.03
5.6.150.0030.08720.96
5.6.140.0030.08021.10
5.6.130.0070.08021.20
5.6.120.0100.08021.20
5.6.110.0100.06021.05
5.6.100.0000.07721.13
5.6.90.0030.09021.14
5.6.80.0070.06320.46
5.6.70.0030.08320.45
5.6.60.0000.07720.41
5.6.50.0030.04020.36
5.6.40.0000.07320.49
5.6.30.0000.05020.30
5.6.20.0070.03320.43
5.6.10.0000.04320.43
5.6.00.0000.07720.38
5.5.360.0000.06320.37
5.5.350.0070.06720.46
5.5.340.0100.08020.91
5.5.330.0100.06320.93
5.5.320.0030.09020.85
5.5.310.0100.07720.90
5.5.300.0070.07720.67
5.5.290.0070.07720.80
5.5.280.0030.08720.89
5.5.270.0100.08020.90
5.5.260.0130.07320.79
5.5.250.0000.09020.60
5.5.240.0070.07020.28
5.5.230.0070.08020.29
5.5.220.0070.04020.31
5.5.210.0000.06720.29
5.5.200.0100.03320.31
5.5.190.0030.04020.20
5.5.180.0000.04720.21
5.5.160.0000.04020.21
5.5.150.0070.03320.15
5.5.140.0000.04020.25
5.5.130.0030.04720.16
5.5.120.0000.04020.30
5.5.110.0070.06720.00
5.5.100.0070.03320.09
5.5.90.0000.04020.12
5.5.80.0000.06020.12
5.5.70.0070.03720.11
5.5.60.0100.06720.16
5.5.50.0100.04720.09
5.5.40.0000.04019.96
5.5.30.0000.05020.02
5.5.20.0070.03720.05
5.5.10.0100.07020.07
5.5.00.0000.05320.11
5.4.450.0070.05719.43
5.4.440.0070.06719.21
5.4.430.0030.08019.45
5.4.420.0030.08719.37
5.4.410.0000.07019.07
5.4.400.0070.07018.95
5.4.390.0030.06319.23
5.4.380.0070.05318.85
5.4.370.0000.04019.09
5.4.360.0030.06019.16
5.4.350.0030.05319.23
5.4.340.0000.04319.16
5.4.320.0000.04019.09
5.4.310.0000.04319.24
5.4.300.0030.03718.90
5.4.290.0000.08019.16
5.4.280.0030.05019.03
5.4.270.0100.05719.06
5.4.260.0030.03719.03
5.4.250.0200.02719.11
5.4.240.0070.03319.04
5.4.230.0030.03719.20
5.4.220.0000.05319.05
5.4.210.0100.07318.90
5.4.200.0030.03718.96
5.4.190.0100.03019.03
5.4.180.0000.04019.11
5.4.170.0070.04319.17
5.4.160.0000.04019.03
5.4.150.0030.06319.01
5.4.140.0070.03016.50
5.4.130.0030.04016.50
5.4.120.0070.03016.22
5.4.110.0000.04316.41
5.4.100.0000.03316.56
5.4.90.0000.03716.53
5.4.80.0030.03316.31
5.4.70.0000.04016.50
5.4.60.0030.03716.39
5.4.50.0000.03016.37
5.4.40.0030.03316.36
5.4.30.0000.03716.49
5.4.20.0000.06316.48
5.4.10.0030.03316.48
5.4.00.0000.03315.90
5.3.290.0000.04014.63
5.3.280.0030.03714.72
5.3.270.0000.04014.76
5.3.260.0000.03314.77
5.3.250.0000.03314.79
5.3.240.0030.02714.74
5.3.230.0000.04314.61
5.3.220.0070.03014.70
5.3.210.0000.03714.61
5.3.200.0000.03714.64
5.3.190.0030.03014.66
5.3.180.0000.03014.69
5.3.170.0030.03014.67
5.3.160.0000.03714.62
5.3.150.0030.03314.71
5.3.140.0000.03714.57
5.3.130.0000.03714.52
5.3.120.0000.04314.65
5.3.110.0000.04014.60
5.3.100.0070.04014.14
5.3.90.0030.03314.00
5.3.80.0000.04714.13
5.3.70.0000.03314.08
5.3.60.0030.03314.16
5.3.50.0000.03313.89
5.3.40.0030.07014.02
5.3.30.0030.05713.96
5.3.20.0070.07313.80
5.3.10.0070.05313.79
5.3.00.0070.06013.62
5.2.170.0000.06313.17
5.2.160.0000.03713.17
5.2.150.0030.03313.17
5.2.140.0070.05713.17
5.2.130.0030.06313.17
5.2.120.0000.04313.17
5.2.110.0070.06013.17
5.2.100.0030.05313.17
5.2.90.0000.05313.17
5.2.80.0000.06313.17
5.2.70.0030.06013.17
5.2.60.0000.06713.17
5.2.50.0030.06013.17
5.2.40.0030.06013.17
5.2.30.0070.05313.17
5.2.20.0000.06713.17
5.2.10.0070.05013.17
5.2.00.0030.04713.17
5.1.60.0070.05313.17
5.1.50.0070.05313.17
5.1.40.0030.06013.17
5.1.30.0030.05013.17
5.1.20.0030.04013.17
5.1.10.0100.04713.17
5.1.00.0030.05313.17
5.0.50.0100.04313.17
5.0.40.0030.04313.17
5.0.30.0070.04313.17
5.0.20.0070.04013.17
5.0.10.0000.04313.17
5.0.00.0000.06013.17
4.4.90.0000.03713.17
4.4.80.0000.03313.17
4.4.70.0000.04013.17
4.4.60.0000.03013.17
4.4.50.0000.03713.17
4.4.40.0070.05013.17
4.4.30.0000.03713.17
4.4.20.0070.02713.17
4.4.10.0000.03013.17
4.4.00.0030.04313.17
4.3.110.0030.03713.17
4.3.100.0030.03313.17
4.3.90.0030.03313.17
4.3.80.0000.05313.17
4.3.70.0070.03013.17
4.3.60.0000.03713.17
4.3.50.0030.02313.17
4.3.40.0030.04713.17
4.3.30.0000.03713.17
4.3.20.0070.03013.17
4.3.10.0070.02313.17
4.3.00.0000.03713.17

preferences:
43.83 ms | 401 KiB | 5 Q