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.0070.00718.31
8.3.50.0170.00922.10
8.3.40.0150.00318.96
8.3.30.0110.00419.10
8.3.20.0070.00020.25
8.3.10.0040.00421.92
8.3.00.0050.00322.51
8.2.180.0150.00316.63
8.2.170.0090.00622.96
8.2.160.0080.00820.93
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0050.00326.16
8.2.120.0050.00319.38
8.2.110.0070.00322.38
8.2.100.0090.00317.78
8.2.90.0000.00719.09
8.2.80.0040.00417.97
8.2.70.0060.00317.38
8.2.60.0000.00918.05
8.2.50.0060.00318.07
8.2.40.0000.00918.34
8.2.30.0000.00718.09
8.2.20.0050.00317.84
8.2.10.0040.00417.75
8.2.00.0040.00417.74
8.1.280.0100.00325.92
8.1.270.0060.00323.96
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0040.00423.86
8.1.230.0040.00819.16
8.1.220.0000.00717.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.53
8.1.180.0040.00418.10
8.1.170.0000.00918.43
8.1.160.0050.00321.90
8.1.150.0040.00418.70
8.1.140.0040.00417.45
8.1.130.0030.00317.81
8.1.120.0070.00017.39
8.1.110.0040.00417.51
8.1.100.0040.00417.38
8.1.90.0040.00417.45
8.1.80.0000.00717.48
8.1.70.0000.00717.43
8.1.60.0040.00417.58
8.1.50.0040.00417.50
8.1.40.0070.00017.49
8.1.30.0000.00817.70
8.1.20.0040.00417.71
8.1.10.0060.00317.57
8.1.00.0050.00317.47
8.0.300.0060.00318.77
8.0.290.0040.00417.04
8.0.280.0000.00718.39
8.0.270.0040.00417.27
8.0.260.0080.00016.94
8.0.250.0040.00417.05
8.0.240.0030.00317.00
8.0.230.0000.00817.02
8.0.220.0000.00817.00
8.0.210.0000.00716.97
8.0.200.0030.00316.92
8.0.190.0040.00417.08
8.0.180.0040.00416.96
8.0.170.0030.00516.92
8.0.160.0040.00416.89
8.0.150.0030.00616.86
8.0.140.0000.00716.97
8.0.130.0000.00513.36
8.0.120.0030.00616.94
8.0.110.0050.00216.96
8.0.100.0040.00416.94
8.0.90.0070.00016.86
8.0.80.0130.00316.93
8.0.70.0050.00316.78
8.0.60.0000.00716.93
8.0.50.0070.00016.80
8.0.30.0100.01217.13
8.0.20.0100.01017.40
8.0.10.0000.00717.15
8.0.00.0120.00616.80
7.4.330.0000.00515.00
7.4.320.0060.00016.49
7.4.300.0050.00316.50
7.4.290.0030.00516.43
7.4.280.0000.00716.46
7.4.270.0080.00016.53
7.4.260.0080.00016.59
7.4.250.0000.00816.59
7.4.240.0040.00416.52
7.4.230.0070.00016.41
7.4.220.0110.00716.55
7.4.210.0080.00616.54
7.4.200.0070.00016.35
7.4.190.0000.00716.38
7.4.160.0090.00616.44
7.4.150.0160.00517.40
7.4.140.0070.01417.86
7.4.130.0080.00916.62
7.4.120.0110.00816.55
7.4.110.0080.00816.70
7.4.100.0150.00616.67
7.4.90.0120.01216.54
7.4.80.0100.00716.63
7.4.70.0080.00816.62
7.4.60.0140.00416.59
7.4.50.0060.00316.64
7.4.40.0090.00622.77
7.4.30.0070.01016.50
7.4.00.0090.00614.96
7.3.330.0060.00013.28
7.3.320.0000.00613.27
7.3.310.0070.00016.48
7.3.300.0030.00316.33
7.3.290.0070.00716.39
7.3.280.0050.01216.44
7.3.270.0030.01417.40
7.3.260.0120.01216.52
7.3.250.0070.01216.48
7.3.240.0070.01016.39
7.3.230.0140.00316.39
7.3.210.0030.01416.32
7.3.200.0040.01619.39
7.3.190.0000.01816.50
7.3.180.0160.00616.43
7.3.170.0030.01316.50
7.3.160.0040.01316.50
7.3.120.0070.01014.91
7.3.00.0120.00416.48
7.2.330.0100.00716.60
7.2.320.0060.01516.80
7.2.310.0110.00816.59
7.2.300.0140.00616.77
7.2.290.0090.00916.49
7.2.130.0070.00716.71
7.2.120.0160.00216.86
7.2.110.0100.00316.69
7.2.100.0110.00816.67
7.2.90.0110.00516.64
7.2.80.0080.00416.71
7.2.70.0110.00516.94
7.2.60.0110.00716.87
7.2.50.0680.01116.97
7.2.40.0120.00316.95
7.2.30.0110.00416.81
7.2.20.0130.00716.74
7.2.10.0150.00216.81
7.2.00.0080.00616.77
7.1.250.0140.00315.77
7.1.240.0120.00315.87
7.1.230.0120.00615.80
7.1.220.0110.00515.73
7.1.210.0120.00515.59
7.1.200.0060.00815.73
7.1.190.0120.00315.86
7.1.180.0090.00715.77
7.1.170.0130.00315.70
7.1.160.0070.00915.62
7.1.150.0050.00915.81
7.1.140.0100.00815.77
7.1.130.0110.00415.68
7.1.120.0090.00915.89
7.1.110.0030.01015.89
7.1.100.0110.00515.77
7.1.90.0090.00715.72
7.1.80.0130.00215.65
7.1.70.0030.00916.30
7.1.60.0090.00817.12
7.1.50.0210.00916.02
7.1.40.0100.00615.76
7.1.30.0090.00515.68
7.1.20.0420.00915.86
7.1.10.0110.00615.66
7.1.00.0050.02917.96
7.0.330.0090.00915.16
7.0.320.0130.00315.19
7.0.310.0090.00615.29
7.0.300.0090.00615.39
7.0.290.0100.00515.45
7.0.280.0070.00915.24
7.0.270.0170.00015.14
7.0.260.0070.00614.94
7.0.250.0080.01015.29
7.0.240.0120.00315.24
7.0.230.0100.00715.38
7.0.220.0130.00315.34
7.0.210.0060.00715.29
7.0.200.0090.00615.58
7.0.190.0030.01115.25
7.0.180.0070.01015.37
7.0.170.0110.00515.49
7.0.160.0100.00615.23
7.0.150.0090.00715.31
7.0.140.0080.02617.57
7.0.130.0050.00815.36
7.0.120.0060.00715.22
7.0.110.0510.00815.23
7.0.100.0110.00715.23
7.0.90.0100.00315.26
7.0.80.0110.00515.26
7.0.70.0060.01716.78
7.0.60.0060.02016.62
7.0.50.0090.02017.10
7.0.40.0050.01615.57
7.0.30.0060.03015.51
7.0.20.0050.01815.68
7.0.10.0060.01415.65
7.0.00.0040.02215.72
5.6.380.0040.01114.48
5.6.370.0110.00514.29
5.6.360.0090.00614.21
5.6.350.0110.00514.35
5.6.340.0100.00314.28
5.6.330.0090.00714.44
5.6.320.0020.01214.48
5.6.310.0080.00714.28
5.6.300.0110.00314.18
5.6.290.0100.00414.22
5.6.280.0110.02516.49
5.6.270.0070.00614.23
5.6.260.0040.00914.41
5.6.250.0030.01014.19
5.6.240.0090.00714.30
5.6.230.0070.00814.28
5.6.220.0040.02016.34
5.6.210.0050.02016.46
5.6.200.0100.01716.49
5.6.190.0060.01816.56
5.6.180.0080.02016.45
5.6.170.0060.01816.49
5.6.160.0050.02216.63
5.6.150.0090.02316.66
5.6.140.0060.01916.52
5.6.130.0060.03016.54
5.6.120.0090.03516.61
5.6.110.0090.03416.46
5.6.100.0070.03416.57
5.6.90.0080.03116.61
5.6.80.0080.03116.18
5.6.70.0110.01916.25
5.6.60.0120.02716.29
5.6.50.0060.03316.28
5.6.40.0090.02016.22
5.6.30.0040.02916.24
5.6.20.0080.02516.30
5.6.10.0120.02716.32
5.6.00.0070.03016.20
5.5.380.0090.00411.00
5.5.370.0060.00711.02
5.5.360.0050.01714.11
5.5.350.0040.01714.19
5.5.340.0110.01814.32
5.5.330.0050.01714.30
5.5.320.0070.03114.14
5.5.310.0070.01814.28
5.5.300.0060.01614.37
5.5.290.0040.03014.36
5.5.280.0090.03014.29
5.5.270.0080.03414.24
5.5.260.0070.02914.32
5.5.250.0070.02414.31
5.5.240.0040.02814.03
5.5.230.0090.02914.09
5.5.220.0060.01913.83
5.5.210.0050.02614.10
5.5.200.0070.03114.20
5.5.190.0080.02714.03
5.5.180.0070.03114.04
5.5.170.0040.00812.73
5.5.160.0080.02914.19
5.5.150.0080.02914.17
5.5.140.0160.01913.92
5.5.130.0110.02814.10
5.5.120.0100.03114.03
5.5.110.0170.02814.06
5.5.100.0160.02214.10
5.5.90.0180.02614.11
5.5.80.0150.01814.23
5.5.70.0160.02414.11
5.5.60.0170.03114.13
5.5.50.0150.01814.10
5.5.40.0080.02814.16
5.5.30.0130.03114.02
5.5.20.0120.02714.12
5.5.10.0070.02014.01
5.5.00.0090.02213.86
5.4.450.0100.02413.81
5.4.440.0080.02513.93
5.4.430.0080.02913.84
5.4.420.0130.02113.68
5.4.410.0070.02813.72
5.4.400.0060.03013.63
5.4.390.0090.02613.65
5.4.380.0120.02613.56
5.4.370.0030.02113.64
5.4.360.0070.02913.85
5.4.350.0090.02613.71
5.4.340.0010.03313.77
5.4.330.0060.00410.98
5.4.320.0080.02913.74
5.4.310.0120.02713.81
5.4.300.0050.02513.67
5.4.290.0110.02713.49
5.4.280.0070.02913.61
5.4.270.0080.02713.33
5.4.260.0050.03213.72
5.4.250.0040.02213.49
5.4.240.0090.02813.47
5.4.230.0110.02413.46
5.4.220.0070.01813.66
5.4.210.0050.03313.70
5.4.200.0130.02513.68
5.4.190.0130.02613.56
5.4.180.0080.02713.43
5.4.170.0090.02513.75
5.4.160.0100.03013.59
5.4.150.0130.03013.65
5.4.140.0110.02712.81
5.4.130.0160.02712.84
5.4.120.0120.02812.70
5.4.110.0050.02012.63
5.4.100.0030.03112.77
5.4.90.0070.02712.77
5.4.80.0100.02712.64
5.4.70.0090.02612.76
5.4.60.0120.02512.66
5.4.50.0130.02512.77
5.4.40.0190.02412.73
5.4.30.0160.02612.81
5.4.20.0190.02712.71
5.4.10.0210.02212.68
5.4.00.0170.02612.58
5.3.290.0070.02411.93
5.3.280.0060.02311.85
5.3.270.0070.02811.84
5.3.260.0100.02711.86
5.3.250.0120.02411.83
5.3.240.0050.03011.72
5.3.230.0120.02811.77
5.3.220.0100.03011.79
5.3.210.0110.02711.77
5.3.200.0070.02511.72
5.3.190.0050.02911.87
5.3.180.0070.02911.90
5.3.170.0040.03011.87
5.3.160.0110.03111.90
5.3.150.0060.02811.90
5.3.140.0090.02911.83
5.3.130.0140.02511.85
5.3.120.0040.03311.82
5.3.110.0120.02811.81
5.3.100.0060.03011.59
5.3.90.0070.03111.66
5.3.80.0100.03011.57
5.3.70.0160.02411.56
5.3.60.0090.02711.58
5.3.50.0150.02311.56
5.3.40.0190.02511.51
5.3.30.0110.02111.62
5.3.20.0190.02611.52
5.3.10.0190.02711.41
5.3.00.0130.02411.40
5.2.170.0060.02810.94
5.2.160.0080.02210.94
5.2.150.0110.01910.94
5.2.140.0110.02110.94
5.2.130.0180.02310.94
5.2.120.0140.02410.94
5.2.110.0120.02010.94
5.2.100.0080.02610.94
5.2.90.0160.01710.94
5.2.80.0160.02310.94
5.2.70.0180.02110.94
5.2.60.0140.02310.94
5.2.50.0110.02510.94
5.2.40.0180.02110.94
5.2.30.0110.01910.94
5.2.20.0090.02410.94
5.2.10.0150.02410.94
5.2.00.0110.01810.94
5.1.60.0120.01810.94
5.1.50.0080.01810.94
5.1.40.0140.01810.94
5.1.30.0140.01610.94
5.1.20.0160.02010.94
5.1.10.0130.01410.94
5.1.00.0110.01810.94
5.0.50.0090.01610.94
5.0.40.0070.01910.94
5.0.30.0130.02010.94
5.0.20.0090.01710.94
5.0.10.0100.01310.94
5.0.00.0080.02410.94
4.4.90.0050.01510.94
4.4.80.0070.01210.94
4.4.70.0080.01510.94
4.4.60.0090.01010.94
4.4.50.0080.01310.94
4.4.40.0090.02010.94
4.4.30.0080.01510.94
4.4.20.0070.01710.94
4.4.10.0050.01410.94
4.4.00.0050.02110.94
4.3.110.0080.01310.94
4.3.100.0090.01310.94
4.3.90.0120.01210.94
4.3.80.0060.02010.94
4.3.70.0100.01310.94
4.3.60.0060.01010.94
4.3.50.0090.01210.94
4.3.40.0110.01710.94
4.3.30.0080.01110.94
4.3.20.0060.01210.94
4.3.10.0040.01410.94
4.3.00.0050.01610.94

preferences:
73.3 ms | 401 KiB | 5 Q