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.0140.00018.55
8.3.50.0080.00822.05
8.3.40.0070.00718.59
8.3.30.0110.00718.76
8.3.20.0080.00018.66
8.3.10.0000.00819.46
8.3.00.0040.00421.79
8.2.180.0070.00716.75
8.2.170.0170.00322.96
8.2.160.0100.00722.13
8.2.150.0000.00824.18
8.2.140.0090.00024.66
8.2.130.0000.00726.16
8.2.120.0050.00321.00
8.2.110.0070.00322.08
8.2.100.0040.00817.84
8.2.90.0030.00517.97
8.2.80.0000.00818.03
8.2.70.0050.00517.75
8.2.60.0030.00617.91
8.2.50.0000.00818.10
8.2.40.0040.00418.32
8.2.30.0000.00819.45
8.2.20.0000.00717.62
8.2.10.0000.00717.82
8.2.00.0030.00617.90
8.1.280.0120.00325.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0120.00328.09
8.1.240.0150.00622.54
8.1.230.0060.00620.99
8.1.220.0080.00017.79
8.1.210.0090.00018.90
8.1.200.0030.00717.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0090.00018.48
8.1.160.0070.00018.82
8.1.150.0040.00418.66
8.1.140.0030.00617.34
8.1.130.0000.00717.85
8.1.120.0000.00717.51
8.1.110.0000.00817.55
8.1.100.0030.00317.45
8.1.90.0040.00417.50
8.1.80.0040.00417.50
8.1.70.0070.00017.43
8.1.60.0060.00317.58
8.1.50.0070.00017.45
8.1.40.0000.00717.54
8.1.30.0040.00417.56
8.1.20.0050.00517.60
8.1.10.0040.00417.57
8.1.00.0080.00017.55
8.0.300.0080.00019.87
8.0.290.0040.00416.75
8.0.280.0070.00018.36
8.0.270.0000.00717.28
8.0.260.0000.00616.96
8.0.250.0030.00616.94
8.0.240.0000.00817.07
8.0.230.0000.00816.98
8.0.220.0070.00016.94
8.0.210.0030.00316.86
8.0.200.0070.00017.00
8.0.190.0040.00417.03
8.0.180.0000.00817.00
8.0.170.0070.00016.96
8.0.160.0000.00717.01
8.0.150.0070.00016.87
8.0.140.0030.00716.84
8.0.130.0000.00613.45
8.0.120.0040.00416.92
8.0.110.0040.00417.07
8.0.100.0070.00016.88
8.0.90.0040.00416.76
8.0.80.0060.00916.88
8.0.70.0000.00817.02
8.0.60.0000.00716.86
8.0.50.0000.00716.89
8.0.30.0120.00917.04
8.0.20.0090.01217.40
8.0.10.0040.00417.13
8.0.00.0060.01316.84
7.4.330.0020.00216.73
7.4.320.0030.00316.58
7.4.300.0060.00016.43
7.4.290.0030.00316.63
7.4.280.0050.00316.42
7.4.270.0000.00716.43
7.4.260.0050.00216.59
7.4.250.0080.00016.43
7.4.240.0000.00816.55
7.4.230.0030.00316.42
7.4.220.0090.01216.62
7.4.210.0060.00916.63
7.4.200.0030.00316.34
7.4.190.0030.00416.71
7.4.160.0080.00816.61
7.4.150.0130.00417.40
7.4.140.0100.00817.86
7.4.130.0120.00716.64
7.4.120.0130.00716.56
7.4.110.0090.00916.51
7.4.100.0030.02016.52
7.4.90.0060.01116.61
7.4.80.0080.00819.39
7.4.70.0170.00616.50
7.4.60.0030.01416.72
7.4.50.0090.00016.43
7.4.40.0090.00622.77
7.4.30.0090.00616.61
7.4.10.0090.00814.92
7.4.00.0080.00814.88
7.3.330.0000.00713.54
7.3.320.0030.00313.31
7.3.310.0000.00716.49
7.3.300.0070.00016.54
7.3.290.0080.00616.36
7.3.280.0070.00916.41
7.3.270.0120.00617.40
7.3.260.0070.01118.24
7.3.250.0070.01216.53
7.3.240.0030.01516.60
7.3.230.0080.00816.45
7.3.210.0080.00816.40
7.3.200.0030.01419.39
7.3.190.0060.00916.44
7.3.180.0070.01016.51
7.3.170.0070.01516.56
7.3.160.0130.00316.57
7.3.130.0050.01214.98
7.3.120.0060.00814.93
7.3.110.0110.00514.78
7.3.100.0060.00815.04
7.3.90.0060.01014.80
7.3.80.0040.00614.99
7.3.70.0060.00914.87
7.3.60.0080.00814.85
7.3.50.0060.00614.86
7.3.40.0070.00614.87
7.3.30.0070.00914.78
7.3.20.0030.01016.79
7.3.10.0070.00716.64
7.3.00.0040.00916.69
7.2.330.0060.01116.55
7.2.320.0180.00316.77
7.2.310.0180.00716.65
7.2.300.0090.01016.71
7.2.290.0070.01016.57
7.2.260.0030.01515.10
7.2.250.0100.00714.86
7.2.240.0080.00714.97
7.2.230.0070.00414.95
7.2.220.0080.00715.11
7.2.210.0020.01115.23
7.2.200.0070.00815.04
7.2.190.0090.00915.02
7.2.180.0040.01015.07
7.2.170.0080.00415.17
7.2.160.0070.01015.15
7.2.150.0020.01116.78
7.2.140.0070.00416.88
7.2.130.0030.00916.72
7.2.120.0090.00816.93
7.2.110.0080.00916.96
7.2.100.0090.00616.93
7.2.90.0110.00616.96
7.2.80.0060.00716.92
7.2.70.0050.00916.98
7.2.60.0080.00816.94
7.2.50.0060.01016.95
7.2.40.0090.00516.84
7.2.30.0100.00516.97
7.2.20.0070.00916.77
7.2.10.0080.00516.86
7.2.00.0020.01317.54
7.1.330.0070.00615.88
7.1.320.0040.00815.84
7.1.310.0030.00815.95
7.1.300.0070.00715.81
7.1.290.0030.01015.74
7.1.280.0030.01315.70
7.1.270.0050.00915.71
7.1.260.0030.00915.54
7.1.250.0070.00615.76
7.1.240.0020.01215.75
7.1.230.0030.00815.80
7.1.220.0050.00915.66
7.1.210.0060.00315.80
7.1.200.0060.00515.78
7.1.190.0050.00915.55
7.1.180.0050.00915.86
7.1.170.0060.01115.74
7.1.160.0020.01115.77
7.1.150.0090.00715.74
7.1.140.0070.00715.78
7.1.130.0060.00615.94
7.1.120.0060.00815.91
7.1.110.0040.00915.78
7.1.100.0070.00916.63
7.1.90.0060.00815.75
7.1.80.0050.00515.96
7.1.70.0040.00616.27
7.1.60.0030.01117.04
7.1.50.0060.01316.10
7.1.40.0060.00815.99
7.1.30.0060.00615.74
7.1.20.0060.00815.77
7.1.10.0060.00915.89
7.1.00.0060.01518.04
7.0.330.0030.01115.39
7.0.320.0040.01115.24
7.0.310.0070.00715.46
7.0.300.0030.01015.43
7.0.290.0060.00615.45
7.0.280.0050.00515.37
7.0.270.0060.00615.56
7.0.260.0030.01015.25
7.0.250.0050.01015.37
7.0.240.0070.00715.37
7.0.230.0020.01215.47
7.0.220.0080.00515.33
7.0.210.0040.00815.46
7.0.200.0050.00815.98
7.0.190.0080.00815.33
7.0.180.0050.00415.40
7.0.170.0090.00415.40
7.0.160.0050.01215.43
7.0.150.0050.00915.56
7.0.140.0050.02917.61
7.0.130.0030.01015.48
7.0.120.0080.00515.31
7.0.110.0070.00715.44
7.0.100.0070.00715.54
7.0.90.0060.00515.44
7.0.80.0040.00815.40
7.0.70.0030.03617.46
7.0.60.0070.02617.45
7.0.50.0070.02817.67
7.0.40.0030.03715.65
7.0.30.0080.02515.59
7.0.20.0040.03515.66
7.0.10.0060.03415.79
7.0.00.0020.02515.56
5.6.400.0040.00614.51
5.6.390.0070.00814.43
5.6.380.0050.01114.28
5.6.370.0020.01614.44
5.6.360.0070.00514.37
5.6.350.0060.00314.38
5.6.340.0100.00414.39
5.6.330.0040.00714.60
5.6.320.0080.00814.45
5.6.310.0070.00614.46
5.6.300.0030.01214.46
5.6.290.0040.01214.55
5.6.280.0060.02916.57
5.6.270.0070.00514.45
5.6.260.0060.01014.46
5.6.250.0050.00514.19
5.6.240.0050.00914.54
5.6.230.0060.00414.22
5.6.220.0030.02616.29
5.6.210.0060.03116.46
5.6.200.0110.02616.64
5.6.190.0080.02116.76
5.6.180.0060.02916.65
5.6.170.0030.03716.77
5.6.160.0030.03416.62
5.6.150.0090.02416.47
5.6.140.0050.03516.59
5.6.130.0060.02716.75
5.6.120.0030.03616.57
5.6.110.0100.03016.67
5.6.100.0020.03716.46
5.6.90.0070.03116.57
5.6.80.0050.03116.43
5.6.70.0060.03316.39
5.6.60.0060.03016.27
5.6.50.0070.03216.41
5.6.40.0040.03016.37
5.6.30.0040.03216.39
5.6.20.0080.02516.28
5.6.10.0060.02916.21
5.6.00.0080.03116.28
5.5.380.0040.00914.40
5.5.370.0070.00814.33
5.5.360.0060.02016.51
5.5.350.0060.03016.29
5.5.340.0100.02016.43
5.5.330.0070.02816.46
5.5.320.0070.03016.58
5.5.310.0040.03516.41
5.5.300.0090.01616.42
5.5.290.0040.03616.39
5.5.280.0060.03416.48
5.5.270.0040.03216.32
5.5.260.0040.03116.50
5.5.250.0050.02616.45
5.5.240.0070.02916.26
5.5.230.0090.03016.25
5.5.220.0050.02916.12
5.5.210.0040.03016.08
5.5.200.0050.01916.38
5.5.190.0040.03416.18
5.5.180.0070.03016.23
5.5.170.0060.00414.20
5.5.160.0080.03016.24
5.5.150.0070.01816.07
5.5.140.0010.03216.29
5.5.130.0030.03316.11
5.5.120.0030.03416.22
5.5.110.0070.02816.21
5.5.100.0040.02516.21
5.5.90.0040.02316.26
5.5.80.0030.03116.19
5.5.70.0070.01516.20
5.5.60.0040.01716.10
5.5.50.0070.02816.25
5.5.40.0060.02516.16
5.5.30.0050.02115.97
5.5.20.0050.03016.36
5.5.10.0050.03116.27
5.5.00.0090.02616.10
5.4.450.0030.03214.31
5.4.440.0060.02914.30
5.4.430.0070.02714.27
5.4.420.0030.03114.16
5.4.410.0030.03214.12
5.4.400.0050.02914.01
5.4.390.0020.03114.03
5.4.380.0040.02414.08
5.4.370.0050.01914.17
5.4.360.0020.02014.08
5.4.350.0030.02314.18
5.4.340.0040.02314.18
5.4.330.0020.00911.62
5.4.320.0060.02713.99
5.4.310.0000.03314.01
5.4.300.0030.01514.19
5.4.290.0050.02314.14
5.4.280.0090.02214.29
5.4.270.0040.03114.09
5.4.260.0030.03014.08
5.4.250.0000.03014.21
5.4.240.0040.02914.18
5.4.230.0040.01914.04
5.4.220.0030.02614.11
5.4.210.0020.03214.05
5.4.200.0060.02914.22
5.4.190.0000.03214.15
5.4.180.0010.03114.12
5.4.170.0030.02314.03
5.4.160.0050.02714.08
5.4.150.0070.02714.10
5.4.140.0060.02613.28
5.4.130.0050.02713.16
5.4.120.0030.02513.34
5.4.110.0050.02813.28
5.4.100.0040.02813.29
5.4.90.0060.02113.34
5.4.80.0060.02713.28
5.4.70.0040.01913.26
5.4.60.0060.01913.33
5.4.50.0020.03113.24
5.4.40.0030.01913.32
5.4.30.0050.02813.22
5.4.20.0050.02613.12
5.4.10.0020.02313.18
5.4.00.0040.02213.05
5.3.290.0030.02812.48
5.3.280.0030.01712.44
5.3.270.0020.03112.43
5.3.260.0040.02812.51
5.3.250.0030.02412.46
5.3.240.0040.03012.43
5.3.230.0020.02812.39
5.3.220.0070.02412.36
5.3.210.0040.03012.35
5.3.200.0040.02512.31
5.3.190.0070.02412.41
5.3.180.0000.03312.42
5.3.170.0070.02812.49
5.3.160.0020.03112.44
5.3.150.0060.02712.40
5.3.140.0040.02112.38
5.3.130.0020.02912.42
5.3.120.0030.02912.47
5.3.110.0040.03012.46
5.3.100.0050.02512.21
5.3.90.0010.02712.22
5.3.80.0020.02412.21
5.3.70.0040.02912.18
5.3.60.0030.02612.29
5.3.50.0020.03012.20
5.3.40.0020.02912.25
5.3.30.0030.03112.21
5.3.20.0020.02812.12
5.3.10.0040.02712.08
5.3.00.0060.02011.99
5.2.170.0000.06312.52
5.2.160.0000.06312.52
5.2.150.0070.06012.52
5.2.140.0030.05012.52
5.2.130.0070.06012.52
5.2.120.0000.06312.52
5.2.110.0030.04312.52
5.2.100.0000.06712.52
5.2.90.0000.05012.52
5.2.80.0030.04012.52
5.2.70.0030.06312.52
5.2.60.0100.06012.52
5.2.50.0000.06312.52
5.2.40.0030.05712.52
5.2.30.0070.06012.52
5.2.20.0070.04712.52
5.2.10.0070.05312.52
5.2.00.0030.03712.52
5.1.60.0100.04712.52
5.1.50.0100.04712.52
5.1.40.0000.05712.52
5.1.30.0000.05712.52
5.1.20.0000.06312.52
5.1.10.0070.05312.52
5.1.00.0030.05712.52
5.0.50.0000.05012.52
5.0.40.0000.05012.52
5.0.30.0070.06012.52
5.0.20.0030.04012.52
5.0.10.0030.04312.52
5.0.00.0000.05312.52
4.4.90.0030.03712.52
4.4.80.0000.02712.52
4.4.70.0030.03312.52
4.4.60.0030.03312.52
4.4.50.0030.02712.52
4.4.40.0000.04012.52
4.4.30.0030.03312.52
4.4.20.0000.02712.52
4.4.10.0000.03712.52
4.4.00.0000.06012.52
4.3.110.0000.03312.52
4.3.100.0030.03312.52
4.3.90.0000.03712.52
4.3.80.0000.05012.52
4.3.70.0030.03312.52
4.3.60.0000.03312.52
4.3.50.0030.03312.52
4.3.40.0000.05312.52
4.3.30.0000.03312.52
4.3.20.0000.03312.52
4.3.10.0000.03012.52
4.3.00.0030.03312.52

preferences:
62.36 ms | 400 KiB | 5 Q