3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decorate(callable $fn) { $decorators = array_slice(func_get_args(), 1); 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.70.0090.00916.63
8.3.60.0090.00616.63
8.3.50.0120.00518.25
8.3.40.0100.00718.96
8.3.30.0130.00718.79
8.3.20.0040.00418.85
8.3.10.0130.00318.78
8.3.00.0030.00619.38
8.2.180.0090.00916.75
8.2.170.0120.00322.96
8.2.160.0160.00020.68
8.2.150.0040.00424.18
8.2.140.0160.00324.66
8.2.130.0080.00626.16
8.2.120.0000.00721.06
8.2.110.0090.00020.79
8.2.100.0040.00717.71
8.2.90.0060.00319.53
8.2.80.0020.00519.21
8.2.70.0030.00617.63
8.2.60.0000.00817.80
8.2.50.0060.00318.07
8.2.40.0040.00418.28
8.2.30.0000.00718.00
8.2.20.0080.00017.61
8.2.10.0000.00717.88
8.2.00.0030.00717.83
8.1.280.0130.00625.92
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00022.43
8.1.230.0080.00320.70
8.1.220.0000.00817.78
8.1.210.0050.00318.84
8.1.200.0030.00617.23
8.1.190.0050.00217.52
8.1.180.0050.00318.10
8.1.170.0000.00818.80
8.1.160.0000.00718.82
8.1.150.0080.00018.77
8.1.140.0000.00817.56
8.1.130.0000.00817.89
8.1.120.0030.00517.37
8.1.110.0020.00517.43
8.1.100.0000.00717.46
8.1.90.0040.00417.40
8.1.80.0070.00017.47
8.1.70.0000.00717.40
8.1.60.0040.00417.61
8.1.50.0050.00217.52
8.1.40.0030.00517.58
8.1.30.0030.00617.63
8.1.20.0050.00317.58
8.1.10.0030.00517.46
8.1.00.0000.00817.51
8.0.300.0050.00219.98
8.0.290.0000.00816.63
8.0.280.0000.00718.34
8.0.270.0030.00317.27
8.0.260.0000.00716.79
8.0.250.0040.00417.10
8.0.240.0000.00717.00
8.0.230.0000.00817.01
8.0.220.0070.00016.86
8.0.210.0000.00916.87
8.0.200.0060.00317.05
8.0.190.0000.00816.93
8.0.180.0040.00416.97
8.0.170.0040.00416.92
8.0.160.0070.00016.89
8.0.150.0050.00316.79
8.0.140.0060.00316.84
8.0.130.0000.00613.34
8.0.120.0000.00916.86
8.0.110.0040.00416.91
8.0.100.0070.00016.86
8.0.90.0040.00416.93
8.0.80.0130.00316.87
8.0.70.0040.00416.78
8.0.60.0040.00416.77
8.0.50.0000.00816.96
8.0.30.0160.00716.92
8.0.20.0080.01117.09
8.0.10.0040.00417.04
8.0.00.0140.00716.65
7.4.330.0030.00312.97
7.4.320.0030.00316.52
7.4.300.0060.00016.54
7.4.290.0030.00316.53
7.4.280.0070.00016.60
7.4.270.0040.00416.61
7.4.260.0030.00313.29
7.4.250.0030.00516.50
7.4.240.0000.00716.63
7.4.230.0070.00016.57
7.4.220.0070.01116.52
7.4.210.0070.01416.50
7.4.200.0000.00716.43
7.4.190.0040.00416.41
7.4.160.0040.01116.61
7.4.150.0090.00916.70
7.4.140.0100.00716.45
7.4.130.0080.00916.71
7.4.120.0070.01016.52
7.4.110.0060.01616.55
7.4.100.0110.01116.68
7.4.90.0160.00616.68
7.4.80.0110.00619.39
7.4.70.0030.01416.54
7.4.60.0090.00816.41
7.4.50.0000.00716.60
7.4.40.0000.01516.58
7.4.30.0090.00716.60
7.4.00.0150.00014.92
7.3.330.0070.00013.28
7.3.320.0000.00513.40
7.3.310.0070.00016.34
7.3.300.0050.00216.25
7.3.290.0070.01016.40
7.3.280.0080.00816.40
7.3.270.0090.00916.44
7.3.260.0110.00616.54
7.3.250.0120.00916.67
7.3.240.0120.00616.69
7.3.230.0140.00316.61
7.3.210.0120.00616.55
7.3.200.0100.00616.39
7.3.190.0130.00316.42
7.3.180.0030.01216.57
7.3.170.0130.00316.60
7.3.160.0160.00016.55
7.3.120.0000.01414.65
7.2.330.0090.00916.73
7.2.320.0110.00716.65
7.2.310.0100.01016.84
7.2.300.0150.00316.78
7.2.290.0060.01016.61
7.2.80.0080.00016.50
7.2.60.0030.01017.05
7.1.200.0130.00016.01
7.1.100.0080.01217.61
7.1.70.0000.01116.92
7.1.60.0040.00719.30
7.1.50.0140.00716.66
7.1.00.0070.07022.45
7.0.200.0090.00316.67
7.0.140.0030.07322.19
7.0.120.0070.06722.18
7.0.60.0100.07321.75
7.0.50.0030.04017.87
7.0.40.0000.08020.40
7.0.30.0300.07720.15
7.0.20.0270.07020.23
7.0.10.0070.07020.25
7.0.00.0030.08720.31
5.6.280.0000.07720.84
5.6.210.0030.08320.72
5.6.200.0130.07318.29
5.6.190.0030.05720.46
5.6.180.0230.06720.39
5.6.170.0400.07320.40
5.6.160.0230.07320.55
5.6.150.0070.08318.18
5.6.140.0030.05718.18
5.6.130.0070.04018.19
5.6.120.0100.08020.99
5.6.110.0100.07721.02
5.6.100.0030.06721.00
5.6.90.0200.07721.00
5.6.80.0130.07320.56
5.5.350.0000.03320.43
5.5.340.0030.08717.98
5.5.330.0070.07020.45
5.5.320.0270.05720.30
5.5.310.0200.04320.51
5.5.300.0030.05717.96
5.5.290.0030.07317.99
5.5.280.0030.08721.00
5.5.270.0000.04720.70
5.5.260.0030.08721.00
5.5.250.0130.07720.61
5.5.240.0130.07320.21
5.4.450.0100.07719.57
5.4.440.0100.04319.54
5.4.430.0130.04019.44
5.4.420.0030.08019.25
5.4.410.0030.03719.12
5.4.400.0030.03719.20
5.4.390.0030.03719.25
5.4.380.0070.03319.16
5.4.370.0030.03719.15
5.4.360.0030.03719.21
5.4.350.0030.03718.86
5.4.340.0000.04018.93
5.4.320.0000.04319.25
5.4.310.0070.03319.01
5.4.300.0030.03719.25
5.4.290.0000.04019.14
5.4.280.0030.03719.10
5.4.270.0100.03018.86
5.4.260.0030.03719.24
5.4.250.0030.03718.86
5.4.240.0030.03719.14
5.4.230.0000.04019.14
5.4.220.0030.03718.84
5.4.210.0070.03319.19
5.4.200.0170.07019.24
5.4.190.0070.07719.14
5.4.180.0030.05719.24
5.4.170.0070.06019.23
5.4.160.0100.05718.96
5.4.150.0130.07019.16
5.4.140.0070.07716.43
5.4.130.0000.08316.34
5.4.120.0100.07316.54
5.4.110.0130.07016.33
5.4.100.0100.05316.42
5.4.90.0070.04316.51
5.4.80.0070.03316.34
5.4.70.0070.07016.49
5.4.60.0070.07016.70
5.4.50.0100.03016.29
5.4.40.0070.04716.40
5.4.30.0100.07016.36
5.4.20.0130.04016.31
5.4.10.0100.06016.45
5.4.00.0030.06015.87
5.3.290.0000.04014.85
5.3.280.0000.04014.64
5.3.270.0000.05314.57
5.3.260.0070.04014.67
5.3.250.0070.07314.56
5.3.240.0070.07714.63
5.3.230.0100.07314.63
5.3.220.0170.06714.64
5.3.210.0000.06714.75
5.3.200.0100.06314.60
5.3.190.0100.07714.75
5.3.180.0030.04314.48
5.3.170.0130.05714.60
5.3.160.0030.05014.74
5.3.150.0130.03314.75
5.3.140.0100.06714.74
5.3.130.0170.06714.46
5.3.120.0030.07714.58
5.3.110.0100.05314.63
5.3.100.0070.04014.14
5.3.90.0070.06713.94
5.3.80.0130.06714.05
5.3.70.0070.04714.21
5.3.60.0100.06714.04
5.3.50.0070.04314.12
5.3.40.0100.05013.97
5.3.30.0070.07313.94
5.3.20.0100.07313.73
5.3.10.0000.07713.59
5.3.00.0170.07013.67
5.2.170.0170.05011.18
5.2.160.0070.04711.21
5.2.150.0130.06011.20
5.2.140.0070.06311.14
5.2.130.0000.04711.14
5.2.120.0000.05011.05
5.2.110.0030.05011.06
5.2.100.0100.06311.27
5.2.90.0030.05311.02
5.2.80.0030.06311.05
5.2.70.0030.06311.07
5.2.60.0030.04310.95
5.2.50.0000.06710.95
5.2.40.0070.05311.02
5.2.30.0100.05010.98
5.2.20.0030.04010.93
5.2.10.0030.06310.88
5.2.00.0000.03310.72
5.1.60.0000.0579.91
5.1.50.0000.05310.02
5.1.40.0000.0479.98
5.1.30.0030.02710.35
5.1.20.0030.04710.25
5.1.10.0030.05010.03
5.1.00.0070.05710.03
5.0.50.0070.0438.72
5.0.40.0000.0438.41
5.0.30.0030.0478.28
5.0.20.0000.0208.26
5.0.10.0030.0208.24
5.0.00.0030.0378.31
4.4.90.0070.0307.39
4.4.80.0000.0237.39
4.4.70.0000.0407.39
4.4.60.0000.0307.39
4.4.50.0100.0177.39
4.4.40.0000.0277.39
4.4.30.0000.0377.39
4.4.20.0030.0177.39
4.4.10.0000.0407.39
4.4.00.0000.0577.39
4.3.110.0000.0377.39
4.3.100.0030.0137.39
4.3.90.0030.0207.39
4.3.80.0000.0277.39
4.3.70.0030.0377.39
4.3.60.0000.0277.39
4.3.50.0000.0277.39
4.3.40.0000.0477.39
4.3.30.0000.0237.39
4.3.20.0000.0207.39
4.3.10.0070.0277.39
4.3.00.0000.0377.39

preferences:
53.72 ms | 401 KiB | 5 Q