3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decorate(callable $fn, callable $decorator) { return function() use ($fn, $decorator) { $d = $decorator(); $gen = $d(); // Only call the wrapped function if the decorator made "yield" if (!$gen instanceof \Generator) { return; } if (is_array($gen->current())) { $arguments = $gen->current(); } else { $arguments = func_get_args(); } // Forward all throwed Exceptions try { $gen->send(call_user_func_array($fn, $arguments)); } catch (\Exception $e) { $gen->throw($e); } }; } function foo($bar) { throw new Exception("Error $bar!"); } function catch_all_exceptions() { return function() { try { (yield); } catch (\Exception $e) { echo "Caught Exception: $e\n"; } }; } function do_something_before() { return function() { echo "Before!\n"; //yield; }; } $foo = decorate(decorate("foo", "catch_all_exceptions"), "do_something_before"); $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.0140.00716.75
8.3.50.0070.00821.95
8.3.40.0070.00718.93
8.3.30.0060.01219.04
8.3.20.0000.00720.16
8.3.10.0030.00523.65
8.3.00.0070.01320.79
8.2.180.0060.00916.63
8.2.170.0110.00422.96
8.2.160.0070.00720.23
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0110.00726.16
8.2.120.0040.00422.06
8.2.110.0060.00321.97
8.2.100.0040.00817.78
8.2.90.0030.00619.22
8.2.80.0050.00317.97
8.2.70.0080.00017.38
8.2.60.0050.00317.80
8.2.50.0030.00518.07
8.2.40.0040.00418.22
8.2.30.0030.00518.09
8.2.20.0000.00817.78
8.2.10.0030.00517.63
8.2.00.0000.00817.70
8.1.280.0090.00625.92
8.1.270.0040.00422.24
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.00823.80
8.1.230.0080.00419.01
8.1.220.0080.00017.74
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0030.00617.55
8.1.180.0040.00418.10
8.1.170.0110.00018.68
8.1.160.0050.00322.07
8.1.150.0000.00818.65
8.1.140.0000.00817.41
8.1.130.0030.00317.70
8.1.120.0000.00717.50
8.1.110.0040.00417.53
8.1.100.0050.00317.39
8.1.90.0030.00517.50
8.1.80.0000.00717.35
8.1.70.0000.00717.32
8.1.60.0080.00017.48
8.1.50.0000.00817.50
8.1.40.0030.00517.46
8.1.30.0030.00617.63
8.1.20.0040.00417.57
8.1.10.0060.00317.61
8.1.00.0100.00017.59
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0030.00318.41
8.0.270.0040.00417.28
8.0.260.0030.00316.84
8.0.250.0030.00316.93
8.0.240.0040.00417.04
8.0.230.0070.00017.01
8.0.220.0030.00316.86
8.0.210.0000.00716.99
8.0.200.0030.00317.05
8.0.190.0030.00516.96
8.0.180.0030.00617.01
8.0.170.0040.00417.06
8.0.160.0070.00017.02
8.0.150.0070.00016.84
8.0.140.0040.00416.92
8.0.130.0030.00313.45
8.0.120.0040.00416.94
8.0.110.0040.00416.89
8.0.100.0040.00417.02
8.0.90.0050.00216.86
8.0.80.0090.00616.86
8.0.70.0040.00416.80
8.0.60.0030.00616.97
8.0.50.0000.00816.90
8.0.30.0090.01117.22
8.0.20.0150.00717.40
8.0.10.0000.00816.98
8.0.00.0140.00616.81
7.4.330.0000.00615.00
7.4.320.0060.00016.58
7.4.300.0030.00316.57
7.4.290.0040.00416.44
7.4.280.0080.00316.50
7.4.270.0000.00716.61
7.4.260.0000.00716.59
7.4.250.0000.00816.49
7.4.240.0000.00716.47
7.4.230.0030.00316.59
7.4.220.0040.01416.45
7.4.210.0140.00416.58
7.4.200.0070.00016.70
7.4.190.0000.00716.78
7.4.160.0070.01016.68
7.4.150.0040.01417.40
7.4.140.0060.01417.86
7.4.130.0100.00616.48
7.4.120.0070.01016.61
7.4.110.0040.01216.48
7.4.100.0060.01516.66
7.4.90.0120.00916.72
7.4.80.0120.01219.39
7.4.70.0120.00616.50
7.4.60.0100.00616.46
7.4.50.0040.00416.18
7.4.40.0100.00322.77
7.4.30.0030.01216.48
7.4.00.0040.01215.07
7.3.330.0000.00513.24
7.3.320.0030.00313.33
7.3.310.0040.00416.40
7.3.300.0000.00716.45
7.3.290.0090.00916.39
7.3.280.0100.00916.46
7.3.270.0040.01417.40
7.3.260.0080.01216.40
7.3.250.0050.01416.31
7.3.240.0120.01216.40
7.3.230.0090.00616.64
7.3.210.0060.01216.67
7.3.200.0060.01516.42
7.3.190.0090.00916.70
7.3.180.0100.00616.49
7.3.170.0120.00316.42
7.3.160.0130.00316.39
7.3.120.0030.01415.00
7.3.10.0120.00016.48
7.3.00.0040.01116.55
7.2.330.0110.00516.61
7.2.320.0140.00716.70
7.2.310.0100.00716.70
7.2.300.0190.00016.43
7.2.290.0000.01616.76
7.2.130.0050.00517.02
7.2.120.0070.00716.95
7.2.110.0070.00716.91
7.2.100.0120.00316.88
7.2.90.0000.01117.00
7.2.80.0070.00416.86
7.2.70.0080.00417.09
7.2.60.0070.00717.08
7.2.50.0060.00616.98
7.2.40.0070.00716.99
7.2.30.0110.00416.90
7.2.20.0030.00616.96
7.2.10.0070.00716.89
7.2.00.0030.00716.93
7.1.250.0000.00915.71
7.1.70.0000.00717.26
7.1.60.0090.00919.29
7.1.50.0060.01616.96
7.1.00.0030.07022.32
7.0.200.0000.00816.69
7.0.140.0000.07021.92
7.0.60.0400.06319.92
7.0.50.0030.08017.86
7.0.40.0170.06720.23
7.0.30.0300.07720.05
7.0.20.0300.07320.10
7.0.10.0030.05720.06
7.0.00.0030.04720.24
5.6.280.0070.07320.88
5.6.210.0030.05720.54
5.6.200.0100.08318.29
5.6.190.0000.05720.77
5.6.180.0400.07020.64
5.6.170.0330.05320.51
5.6.160.0070.09020.51
5.6.150.0070.06718.18
5.6.140.0100.08318.19
5.6.130.0070.06018.24
5.6.120.0070.05320.99
5.6.110.0130.06721.00
5.6.100.0130.07021.01
5.6.90.0030.04021.06
5.6.80.0200.07320.42
5.5.350.0330.07020.45
5.5.340.0030.07017.96
5.5.330.0030.06020.36
5.5.320.0230.04720.35
5.5.310.0130.04720.26
5.5.300.0070.07718.05
5.5.290.0130.06018.08
5.5.280.0130.07020.89
5.5.270.0030.06020.87
5.5.260.0100.06320.67
5.5.250.0030.07020.57
5.5.240.0130.07020.19
5.4.450.0300.07319.54
5.4.440.0330.07319.55
5.4.430.0300.06319.52
5.4.420.0300.05719.27
5.4.410.0370.04319.16
5.4.400.0370.03718.93
5.4.390.0270.07719.01
5.4.380.0330.03719.17
5.4.370.0370.05319.20
5.4.360.0300.06319.22
5.4.350.0400.06019.16
5.4.340.0370.06319.13
5.4.320.0300.06319.03
5.4.310.0270.07719.23
5.4.300.0230.04019.20
5.4.290.0270.07719.10
5.4.280.0330.05719.14
5.4.270.0230.05319.10
5.4.260.0300.07019.10
5.4.250.0370.07018.94
5.4.240.0370.05018.99
5.4.230.0230.08018.96
5.4.220.0300.06719.22
5.4.210.0200.06019.15
5.4.200.0230.03319.12
5.4.190.0100.04319.02
5.4.180.0230.03319.21
5.4.170.0230.04019.21
5.4.160.0100.04719.12
5.4.150.0330.03319.13
5.4.140.0170.04016.56
5.4.130.0170.03716.48
5.4.120.0100.04316.41
5.4.110.0230.03316.68
5.4.100.0200.03316.52
5.4.90.0230.03316.68
5.4.80.0270.02716.47
5.4.70.0230.03316.47
5.4.60.0170.03316.34
5.4.50.0200.03316.21
5.4.40.0200.04316.63
5.4.30.0230.03016.19
5.4.20.0270.03716.41
5.4.10.0270.02716.41
5.4.00.0100.04315.95
5.3.290.0270.07714.75
5.3.280.0270.07714.70
5.3.270.0170.03714.66
5.3.260.0130.04314.64
5.3.250.0170.04314.63
5.3.240.0200.03314.65
5.3.230.0170.04014.64
5.3.220.0100.04014.61
5.3.210.0170.04714.63
5.3.200.0100.04314.64
5.3.190.0270.03014.59
5.3.180.0200.03714.63
5.3.170.0130.04314.65
5.3.160.0230.03314.76
5.3.150.0170.04014.64
5.3.140.0230.03314.50
5.3.130.0300.03714.63
5.3.120.0200.04014.64
5.3.110.0200.03714.61
5.3.100.0130.04014.07
5.3.90.0200.03714.08
5.3.80.0170.04014.00
5.3.70.0270.02714.03
5.3.60.0200.03714.03
5.3.50.0200.03314.04
5.3.40.0100.04314.12
5.3.30.0200.03713.86
5.3.20.0170.03713.77
5.3.10.0170.04013.73
5.3.00.0230.05713.81
5.2.170.0130.03311.18
5.2.160.0170.03711.09
5.2.150.0200.02711.14
5.2.140.0200.02711.21
5.2.130.0230.02311.25
5.2.120.0170.04011.10
5.2.110.0300.05311.25
5.2.100.0270.02311.07
5.2.90.0270.02711.14
5.2.80.0230.04311.04
5.2.70.0330.03010.98
5.2.60.0230.06311.01
5.2.50.0300.03310.90
5.2.40.0270.05311.05
5.2.30.0300.04711.00
5.2.20.0230.05310.97
5.2.10.0200.05711.02
5.2.00.0270.03010.72
5.1.60.0200.04310.04
5.1.50.0230.02310.13
5.1.40.0130.0309.88
5.1.30.0130.03010.40
5.1.20.0170.02710.24
5.1.10.0270.05010.11
5.1.00.0270.03710.04
5.0.50.0200.0338.59
5.0.40.0130.0408.31
5.0.30.0270.0478.24
5.0.20.0070.0238.24
5.0.10.0130.0478.30
5.0.00.0070.0538.24
4.4.90.0130.0238.24
4.4.80.0070.0308.24
4.4.70.0100.0338.24
4.4.60.0100.0338.24
4.4.50.0070.0278.24
4.4.40.0130.0478.24
4.4.30.0100.0178.24
4.4.20.0100.0338.24
4.4.10.0130.0308.24
4.4.00.0170.0378.24
4.3.110.0130.0378.24
4.3.100.0100.0178.24
4.3.90.0130.0308.24
4.3.80.0130.0538.24
4.3.70.0100.0338.24
4.3.60.0070.0178.24
4.3.50.0100.0238.24
4.3.40.0130.0478.24
4.3.30.0000.0438.24
4.3.20.0070.0378.24
4.3.10.0070.0308.24
4.3.00.0130.0308.24

preferences:
40.16 ms | 401 KiB | 5 Q