3v4l.org

run code in 300+ PHP versions simultaneously
<?php function run_test($name, $callback) { $result = $callback(); echo "ran '$name' with result ", var_export($result, true), "\n"; } $method1 = function($test) { return function () use ($test) { if (method_exists($test, 'setup')) { $test->setup(); } }; }; $method2 = function($test) { $func = method_exists($test, 'setup') ? function() use ($test) { $test->setup(); } : function () {}; return function () use ($func) { $func(); }; }; $method3 = function($test) { $test = method_exists($test, 'setup') ? array($test, 'setup') : function () {}; return function () use ($test) { $test(); }; }; class Foo {} class Bar { function setup() {} } run_test('foo1', $method1(new Foo())); run_test('bar1', $method1(new Bar())); run_test('foo2', $method2(new Foo())); run_test('bar2', $method2(new Bar())); run_test('foo3', $method3(new Foo())); run_test('bar3', $method3(new 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.0040.01421.02
8.3.40.0070.01518.73
8.3.30.0140.00719.08
8.3.20.0040.00420.38
8.3.10.0090.00021.80
8.3.00.0040.00422.37
8.2.180.0110.00416.35
8.2.170.0140.00322.96
8.2.160.0040.01120.37
8.2.150.0090.00024.18
8.2.140.0090.00924.66
8.2.130.0120.00626.16
8.2.120.0000.00919.66
8.2.110.0090.00020.39
8.2.100.0030.00819.38
8.2.90.0000.00819.41
8.2.80.0030.00519.25
8.2.70.0040.00417.63
8.2.60.0060.00317.93
8.2.50.0050.00318.07
8.2.40.0000.00817.92
8.2.30.0000.00819.82
8.2.20.0030.00517.49
8.2.10.0040.00417.70
8.2.00.0000.00817.74
8.1.280.0140.00025.92
8.1.270.0030.00620.54
8.1.260.0040.00426.35
8.1.250.0080.00628.09
8.1.240.0060.00323.97
8.1.230.0000.01218.90
8.1.220.0040.00417.76
8.1.210.0090.00018.77
8.1.200.0090.00017.35
8.1.190.0000.00817.53
8.1.180.0040.00420.24
8.1.170.0040.00418.67
8.1.160.0000.00722.16
8.1.150.0040.00418.70
8.1.140.0000.00717.38
8.1.130.0080.00017.76
8.1.120.0000.00717.42
8.1.110.0030.00617.43
8.1.100.0070.00017.45
8.1.90.0050.00217.33
8.1.80.0050.00317.55
8.1.70.0000.00717.49
8.1.60.0030.00617.48
8.1.50.0000.00817.47
8.1.40.0040.00417.34
8.1.30.0000.00817.60
8.1.20.0000.00817.67
8.1.10.0030.00517.55
8.1.00.0040.00417.50
8.0.300.0070.00018.77
8.0.290.0000.00717.18
8.0.280.0030.00518.38
8.0.270.0040.00417.26
8.0.260.0060.00016.84
8.0.250.0000.00717.01
8.0.240.0080.00016.94
8.0.230.0000.00716.95
8.0.220.0050.00316.91
8.0.210.0000.00716.88
8.0.200.0000.00616.88
8.0.190.0040.00417.03
8.0.180.0090.00016.88
8.0.170.0040.00416.95
8.0.160.0000.00716.92
8.0.150.0040.00416.82
8.0.140.0080.00316.84
8.0.130.0030.00313.32
8.0.120.0080.00016.91
8.0.110.0000.00716.91
8.0.100.0040.00416.80
8.0.90.0000.00716.76
8.0.80.0030.01316.79
8.0.70.0040.00416.79
8.0.60.0050.00216.72
8.0.50.0000.00716.97
8.0.30.0100.01017.14
8.0.20.0110.00917.40
8.0.10.0070.00017.06
8.0.00.0080.00916.80
7.4.330.0030.00315.00
7.4.320.0060.00016.59
7.4.300.0000.00616.48
7.4.290.0000.00716.62
7.4.280.0000.00816.45
7.4.270.0070.00016.63
7.4.260.0030.00316.52
7.4.250.0070.00016.60
7.4.240.0030.00416.55
7.4.230.0000.00716.33
7.4.220.0090.01016.64
7.4.210.0070.00716.68
7.4.200.0020.00516.44
7.4.190.0070.00016.32
7.4.160.0040.01316.34
7.4.150.0090.00917.40
7.4.140.0080.01317.86
7.4.130.0110.00716.40
7.4.120.0090.00716.53
7.4.110.0070.01116.72
7.4.100.0130.00416.66
7.4.90.0060.01116.53
7.4.80.0120.00619.39
7.4.70.0140.00316.54
7.4.60.0130.00516.33
7.4.50.0000.00816.44
7.4.40.0040.00722.77
7.4.30.0160.00016.57
7.4.00.0060.00615.05
7.3.330.0030.00313.37
7.3.320.0000.00613.22
7.3.310.0030.00316.40
7.3.300.0060.00016.33
7.3.290.0180.00316.42
7.3.280.0070.00916.36
7.3.270.0110.00617.40
7.3.260.0120.00616.34
7.3.250.0140.00416.50
7.3.240.0140.00716.64
7.3.230.0110.01216.65
7.3.210.0140.00316.33
7.3.200.0090.00919.39
7.3.190.0130.00716.52
7.3.180.0140.00416.40
7.3.170.0160.00016.49
7.3.160.0100.00716.35
7.3.120.0000.01314.97
7.2.330.0060.01416.89
7.2.320.0120.01016.77
7.2.310.0060.00916.54
7.2.300.0080.00816.66
7.2.290.0030.01316.50
7.1.70.0130.00017.20
7.1.60.0110.01419.50
7.1.50.0000.02117.07
7.1.00.0000.03722.44
7.0.200.0040.00416.98
7.0.140.0000.07722.07
7.0.60.0030.04019.87
7.0.50.0100.04017.82
7.0.40.0030.09020.04
7.0.30.0600.06720.16
7.0.20.0270.07020.09
7.0.10.0100.04720.23
7.0.00.0030.06720.33
5.6.280.0030.07321.13
5.6.210.0030.08320.57
5.6.200.0070.03718.28
5.6.190.0030.07720.61
5.6.180.3230.04020.55
5.6.170.0270.07720.55
5.6.160.0170.06020.45
5.6.150.0000.04318.18
5.6.140.0170.07018.13
5.6.130.0030.06018.29
5.6.120.0000.09721.06
5.6.110.0070.08721.15
5.6.100.0070.07720.91
5.6.90.0100.07020.98
5.6.80.0070.07720.31
5.5.350.0300.07720.46
5.5.340.0030.04717.94
5.5.330.0130.07320.42
5.5.320.0200.05020.28
5.5.310.0230.06020.32
5.5.300.0070.08018.07
5.5.290.0070.03717.97
5.5.280.0070.08720.89
5.5.270.0070.08320.88
5.5.260.0070.08720.99
5.5.250.0070.07320.79
5.5.240.3100.03320.28
5.4.450.1930.04319.52
5.4.440.1670.04019.42
5.4.430.1570.04319.56
5.4.420.1600.04019.16
5.4.410.1900.04019.04
5.4.400.1700.03719.14
5.4.390.1830.04319.17
5.4.380.1930.03719.07
5.4.370.1830.04018.84
5.4.360.1870.04318.84
5.4.350.1830.03319.24
5.4.340.0230.05319.15
5.4.320.0130.05319.14
5.4.310.0270.07018.95
5.4.300.0130.05019.08
5.4.290.0200.03319.14
5.4.280.0230.04319.22
5.4.270.0230.07019.22
5.4.260.0170.04719.21
5.4.250.0130.05019.15
5.4.240.0230.03319.15
5.4.230.0100.06018.98
5.4.220.0170.06019.22
5.4.210.0200.03318.84
5.4.200.0270.04019.16
5.4.190.0170.03719.30
5.4.180.0170.04718.86
5.4.170.0300.06019.30
5.4.160.0230.04019.13
5.4.150.0170.03718.96
5.4.140.0200.03016.56
5.4.130.0130.04016.55
5.4.120.0230.06016.39
5.4.110.0200.04716.25
5.4.100.0200.03316.42
5.4.90.0130.04316.60
5.4.80.0170.04016.38
5.4.70.0270.04716.59
5.4.60.0100.04016.57
5.4.50.0170.04716.49
5.4.40.0200.04016.59
5.4.30.0200.03316.27
5.4.20.0270.02316.30
5.4.10.0100.04016.47
5.4.00.0130.04015.82
5.3.290.0200.03314.71
5.3.280.0100.06314.70
5.3.270.0300.06314.71
5.3.260.0230.06714.60
5.3.250.0100.05714.65
5.3.240.0130.04314.75
5.3.230.0200.03714.85
5.3.220.0330.02714.57
5.3.210.0170.04014.52
5.3.200.0230.04314.82
5.3.190.0230.03714.71
5.3.180.0170.04314.52
5.3.170.0230.03314.52
5.3.160.0130.05714.51
5.3.150.0200.05314.67
5.3.140.0230.03714.61
5.3.130.0130.04314.59
5.3.120.0270.05714.64
5.3.110.0130.05014.49
5.3.100.0270.04013.98
5.3.90.0170.05013.95
5.3.80.0170.04314.20
5.3.70.0230.04313.96
5.3.60.0270.03714.11
5.3.50.0230.03313.99
5.3.40.0230.03014.13
5.3.30.0000.04313.85
5.3.20.0130.03713.64
5.3.10.0170.03313.82
5.3.00.0170.03313.60
5.2.170.0100.03711.07
5.2.160.0200.03011.24
5.2.150.0170.06711.05
5.2.140.0200.03711.07
5.2.130.0230.02711.15
5.2.120.0130.03711.21
5.2.110.0130.05711.25
5.2.100.0170.04311.17
5.2.90.0270.05011.01
5.2.80.0200.05711.10
5.2.70.0170.03711.17
5.2.60.0130.04011.05
5.2.50.0170.05310.93
5.2.40.0130.03010.91
5.2.30.0130.03010.89
5.2.20.0170.03011.19
5.2.10.0100.03310.77
5.2.00.0130.06010.80
5.1.60.0130.02710.04
5.1.50.0170.0339.89
5.1.40.0170.0209.96
5.1.30.0100.03310.30
5.1.20.0070.03310.32
5.1.10.0100.02710.11
5.1.00.0130.02310.19
5.0.50.0070.0238.42
5.0.40.0030.0278.39
5.0.30.0030.0338.27
5.0.20.0070.0238.28
5.0.10.0100.0178.07
5.0.00.0070.0308.31
4.4.90.0070.0177.98
4.4.80.0070.0107.98
4.4.70.0000.0177.98
4.4.60.0000.0207.98
4.4.50.0070.0137.98
4.4.40.0030.0277.98
4.4.30.0030.0177.98
4.4.20.0030.0177.98
4.4.10.0070.0137.98
4.4.00.0030.0277.98
4.3.110.0070.0177.98
4.3.100.0070.0137.98
4.3.90.0100.0277.98
4.3.80.0030.0277.98
4.3.70.0030.0177.98
4.3.60.0070.0177.98
4.3.50.0070.0137.98
4.3.40.0070.0277.98
4.3.30.0030.0137.98
4.3.20.0000.0177.98
4.3.10.0000.0177.98
4.3.00.0000.0177.98

preferences:
46.33 ms | 401 KiB | 5 Q