3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decorate(callable $fn, array $decorators) { foreach ($decorators as $d) { $wrapper = $d($fn); $fn = $wrapper; } return $wrapper; } 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("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.0060.01018.30
8.3.50.0100.00821.27
8.3.40.0070.01018.75
8.3.30.0110.00419.19
8.3.20.0070.00020.21
8.3.10.0040.00422.11
8.3.00.0070.00022.52
8.2.180.0140.00016.48
8.2.170.0070.00722.96
8.2.160.0100.00318.98
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.49
8.2.110.0090.00021.00
8.2.100.0030.00917.84
8.2.90.0000.00819.14
8.2.80.0060.00217.97
8.2.70.0040.00417.50
8.2.60.0030.00517.93
8.2.50.0030.00718.07
8.2.40.0000.00819.88
8.2.30.0040.00417.99
8.2.20.0040.00417.79
8.2.10.0040.00417.65
8.2.00.0050.00217.79
8.1.280.0040.01125.92
8.1.270.0000.00722.24
8.1.260.0000.00726.35
8.1.250.0060.00328.09
8.1.240.0070.00323.83
8.1.230.0060.00620.89
8.1.220.0040.00417.76
8.1.210.0040.00418.77
8.1.200.0000.00917.23
8.1.190.0050.00317.23
8.1.180.0000.00818.66
8.1.170.0030.00618.59
8.1.160.0000.00722.17
8.1.150.0000.00718.66
8.1.140.0000.01217.32
8.1.130.0000.00717.70
8.1.120.0000.00717.32
8.1.110.0000.00817.41
8.1.100.0000.00717.38
8.1.90.0000.00717.44
8.1.80.0030.00317.41
8.1.70.0030.00317.34
8.1.60.0090.00017.55
8.1.50.0000.00717.43
8.1.40.0040.00417.46
8.1.30.0000.00717.59
8.1.20.0050.00317.60
8.1.10.0030.00617.54
8.1.00.0030.00517.50
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0000.00718.33
8.0.270.0040.00417.28
8.0.260.0060.00016.86
8.0.250.0000.00717.01
8.0.240.0040.00416.94
8.0.230.0040.00416.88
8.0.220.0000.00716.81
8.0.210.0070.00016.89
8.0.200.0060.00017.03
8.0.190.0040.00416.93
8.0.180.0040.00416.89
8.0.170.0030.00516.90
8.0.160.0020.00516.86
8.0.150.0060.00316.95
8.0.140.0040.00417.01
8.0.130.0030.00313.38
8.0.120.0060.00316.94
8.0.110.0080.00017.00
8.0.100.0000.00716.84
8.0.90.0020.00516.98
8.0.80.0130.00316.93
8.0.70.0040.00416.95
8.0.60.0030.00516.80
8.0.50.0000.00716.98
8.0.30.0070.01217.20
8.0.20.0130.00617.40
8.0.10.0040.00416.96
8.0.00.0090.01316.81
7.4.330.0030.00315.00
7.4.320.0040.00416.57
7.4.300.0000.00616.42
7.4.290.0030.00316.48
7.4.280.0030.00316.55
7.4.270.0000.00816.57
7.4.260.0000.00716.46
7.4.250.0060.00316.51
7.4.240.0030.00316.57
7.4.230.0000.00716.57
7.4.220.0110.00716.53
7.4.210.0100.00816.56
7.4.200.0000.00716.32
7.4.190.0040.00416.63
7.4.160.0160.00616.27
7.4.150.0070.01017.40
7.4.140.0090.00917.86
7.4.130.0140.00716.50
7.4.120.0090.01016.52
7.4.110.0070.01016.43
7.4.100.0110.00716.49
7.4.90.0060.01416.45
7.4.80.0120.00619.39
7.4.70.0090.00916.32
7.4.60.0130.02116.53
7.4.50.0030.00316.59
7.4.40.0070.01122.77
7.4.30.0100.01016.54
7.4.00.0000.01415.14
7.3.330.0000.00513.32
7.3.320.0020.00213.32
7.3.310.0030.00316.34
7.3.300.0040.00416.33
7.3.290.0110.00316.39
7.3.280.0120.00516.29
7.3.270.0110.00617.40
7.3.260.0030.01416.31
7.3.250.0120.00516.39
7.3.240.0070.01016.48
7.3.230.0090.01416.39
7.3.210.0100.00716.44
7.3.200.0130.00719.39
7.3.190.0060.01116.37
7.3.180.0060.01016.20
7.3.170.0170.00316.46
7.3.160.0100.01016.46
7.3.120.0110.00714.79
7.2.330.0110.00816.54
7.2.320.0030.01916.36
7.2.310.0130.00316.57
7.2.300.0140.00316.76
7.2.290.0030.01316.63
7.2.110.0110.00716.63
7.2.100.0080.00816.44
7.2.90.0990.01216.54
7.2.80.0130.00616.72
7.2.70.0030.01316.95
7.2.60.0120.00416.59
7.2.50.0080.00816.90
7.2.40.0150.00316.84
7.2.30.0270.00716.69
7.2.20.0110.00416.65
7.2.10.0220.00616.48
7.2.00.0050.00818.07
7.1.230.0030.01015.66
7.1.220.1920.01315.59
7.1.210.0130.00415.35
7.1.200.0080.00615.64
7.1.190.0140.00315.81
7.1.180.0130.00315.59
7.1.170.0000.01815.49
7.1.160.0270.01215.54
7.1.150.0130.00415.72
7.1.140.0140.00315.52
7.1.130.0080.00815.65
7.1.120.0070.00715.65
7.1.110.0130.00315.71
7.1.100.0060.00816.73
7.1.90.0110.00715.69
7.1.80.0120.00415.71
7.1.70.0060.00616.24
7.1.60.0120.01017.81
7.1.50.0130.00816.43
7.1.40.0130.00615.82
7.1.30.0110.01115.77
7.1.20.0180.00215.79
7.1.10.0090.00315.39
7.1.00.0080.04018.87
7.0.310.0130.00315.12
7.0.300.0400.01215.06
7.0.290.0060.01115.16
7.0.280.0120.00415.27
7.0.270.0100.00715.24
7.0.260.0080.00815.28
7.0.250.0130.00015.19
7.0.240.0100.00715.30
7.0.230.0150.00015.39
7.0.220.0150.00515.40
7.0.210.0100.00715.08
7.0.200.0040.00815.93
7.0.190.0060.00715.41
7.0.180.0110.00415.27
7.0.170.0030.01015.20
7.0.160.0100.00315.38
7.0.150.0120.00415.35
7.0.140.0090.03618.69
7.0.130.0110.00415.42
7.0.120.0140.00015.30
7.0.110.0150.00615.12
7.0.100.0100.04517.67
7.0.90.0100.04617.75
7.0.80.0100.04017.66
7.0.70.0040.02417.59
7.0.60.0020.02517.51
7.0.50.0180.02617.89
7.0.40.0080.03816.75
7.0.30.0040.04516.86
7.0.20.0080.02316.68
7.0.10.0060.02216.67
7.0.00.0100.02216.74
5.6.380.0080.00814.11
5.6.370.0120.00814.35
5.6.360.0120.00214.26
5.6.350.0080.00814.35
5.6.340.0100.00514.32
5.6.330.0090.00314.30
5.6.320.0110.00414.42
5.6.310.0080.00814.25
5.6.300.0070.00514.22
5.6.290.0000.01314.22
5.6.280.0060.04017.64
5.6.270.0070.01114.29
5.6.260.0090.00614.01
5.6.250.0060.04617.36
5.6.240.0120.04217.46
5.6.230.0090.03317.36
5.6.220.0060.02617.33
5.6.210.0060.02217.33
5.6.200.0110.02217.61
5.6.190.0110.03117.63
5.6.180.0070.03717.60
5.6.170.0070.04217.67
5.6.160.0080.02117.63
5.6.150.0060.03217.52
5.6.140.0050.02717.64
5.6.130.0050.02517.80
5.6.120.0120.02017.64
5.6.110.0080.02117.62
5.6.100.0090.02117.67
5.6.90.0060.02317.51
5.6.80.0070.02417.27
5.6.70.0090.02517.26
5.6.60.0070.02117.29
5.6.50.0050.02517.26
5.6.40.0140.01517.40
5.6.30.0100.02017.32
5.6.20.0050.03717.27
5.6.10.0060.02217.30
5.6.00.0100.03517.35
5.5.380.0030.04716.65
5.5.370.0110.04116.61
5.5.360.0070.02116.62
5.5.350.0030.02516.59
5.5.340.0040.02616.85
5.5.330.0080.04116.86
5.5.320.0070.02316.81
5.5.310.0040.04216.86
5.5.300.0050.03216.85
5.5.290.0050.02716.86
5.5.280.0080.03316.87
5.5.270.0110.03816.86
5.5.260.0100.02016.87
5.5.250.0130.01916.74
5.5.240.0060.02016.56
5.5.230.0100.01816.49
5.5.220.0070.02316.50
5.5.210.0060.02316.55
5.5.200.0070.02316.46
5.5.190.0080.02316.52
5.5.180.0080.03316.45
5.5.170.0060.00914.08
5.5.160.0070.02416.40
5.5.150.0070.02316.52
5.5.140.0050.03616.54
5.5.130.0020.04416.53
5.5.120.0080.03316.52
5.5.110.0100.02516.45
5.5.100.0050.02716.40
5.5.90.0000.03016.44
5.5.80.0080.02816.49
5.5.70.0040.03916.44
5.5.60.0100.02916.43
5.5.50.0080.03616.39
5.5.40.0090.04116.40
5.5.30.0100.03316.43
5.5.20.0020.04416.45
5.5.10.0060.04116.39
5.5.00.0060.04516.46
5.4.450.0060.02316.15
5.4.440.0090.02616.18
5.4.430.0110.02316.11
5.4.420.0090.01816.14
5.4.410.0030.02416.08
5.4.400.0080.03515.84
5.4.390.0090.01715.96
5.4.380.0030.02815.91
5.4.370.0110.01815.92
5.4.360.0060.02115.99
5.4.350.0030.02115.99
5.4.340.0040.02415.92
5.4.330.0090.00012.79
5.4.320.0090.01715.94
5.4.310.0050.03515.92
5.4.300.0050.04115.91
5.4.290.0100.03715.82
5.4.280.0050.04415.82
5.4.270.0110.03115.96
5.4.260.0100.03315.91
5.4.250.0020.02515.94
5.4.240.0050.04115.87
5.4.230.0100.02815.84
5.4.220.0100.03415.92
5.4.210.0040.02415.83
5.4.200.0130.03315.92
5.4.190.0090.03315.89
5.4.180.0080.04115.87
5.4.170.0110.03715.82
5.4.160.0060.04415.87
5.4.150.0030.02515.90
5.4.140.0050.04214.64
5.4.130.0120.02014.58
5.4.120.0100.02814.54
5.4.110.0080.03514.66
5.4.100.0090.02014.59
5.4.90.0070.03014.56
5.4.80.0070.04014.65
5.4.70.0110.03814.65
5.4.60.0070.03714.63
5.4.50.0070.02714.56
5.4.40.0100.03514.58
5.4.30.0110.03514.60
5.4.20.0070.04114.60
5.4.10.0060.04314.52
5.4.00.0060.03714.30
5.3.290.0130.01813.76
5.3.280.0050.02413.77
5.3.270.0070.02513.72
5.3.260.0020.03113.78
5.3.250.0100.03513.68
5.3.240.0030.03713.74
5.3.230.0120.03513.68
5.3.220.0100.02313.72
5.3.210.0070.04013.72
5.3.200.0130.03313.71
5.3.190.0080.03913.66
5.3.180.0090.03613.73
5.3.170.0040.02413.72
5.3.160.0000.04613.70
5.3.150.0100.03313.70
5.3.140.0060.02713.68
5.3.130.0080.03013.75
5.3.120.0030.04613.73
5.3.110.0050.02813.74
5.3.100.0080.03213.49
5.3.90.0090.03513.49
5.3.80.0080.03413.49
5.3.70.0100.02813.49
5.3.60.0060.04213.49
5.3.50.0080.02213.49
5.3.40.0060.02313.49
5.3.30.0070.03413.49
5.3.20.0040.02913.49
5.3.10.0040.03613.49
5.3.00.0020.04113.49
5.2.170.0080.03113.49
5.2.160.0030.02713.49
5.2.150.0060.03013.49
5.2.140.0130.02713.49
5.2.130.0050.02413.49
5.2.120.0070.02913.49
5.2.110.0090.01213.49
5.2.100.0080.01513.49
5.2.90.0060.01913.49
5.2.80.0000.02113.49
5.2.70.0070.03013.49
5.2.60.0050.02813.49
5.2.50.0080.02813.49
5.2.40.0050.02713.49
5.2.30.0030.01913.49
5.2.20.0020.03213.49
5.2.10.0070.03113.49
5.2.00.0070.02113.49
5.1.60.0080.01513.49
5.1.50.0090.01013.49
5.1.40.0040.01513.49
5.1.30.0060.02813.49
5.1.20.0050.03013.49
5.1.10.0050.03013.49
5.1.00.0060.01313.49
5.0.50.0000.01713.49
5.0.40.0030.02313.49
5.0.30.0040.02513.49
5.0.20.0080.01313.49
5.0.10.0050.02313.49
5.0.00.0030.03513.49
4.4.90.0020.00913.49
4.4.80.0060.01513.49
4.4.70.0000.02213.49
4.4.60.0000.02213.49
4.4.50.0030.01813.49
4.4.40.0040.01413.49
4.4.30.0050.02013.49
4.4.20.0020.01013.49
4.4.10.0020.01713.49
4.4.00.0030.02713.49
4.3.110.0020.01813.49
4.3.100.0020.02113.49
4.3.90.0040.01113.49
4.3.80.0020.02713.49
4.3.70.0020.01513.49
4.3.60.0030.01813.49
4.3.50.0040.01913.49
4.3.40.0060.02713.49
4.3.30.0040.01213.49
4.3.20.0020.01813.49
4.3.10.0070.01513.49
4.3.00.0020.01513.49

preferences:
43.27 ms | 401 KiB | 5 Q