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) { call_user_func($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.0150.00418.43
8.3.50.0120.00321.08
8.3.40.0150.00618.83
8.3.30.0130.00419.10
8.3.20.0050.00220.05
8.3.10.0000.00822.00
8.3.00.0070.00022.39
8.2.180.0120.00318.32
8.2.170.0040.01122.96
8.2.160.0070.00720.34
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0110.01126.16
8.2.120.0060.00319.67
8.2.110.0030.00620.54
8.2.100.0060.00617.91
8.2.90.0030.00519.21
8.2.80.0040.00417.97
8.2.70.0030.00617.49
8.2.60.0080.00017.80
8.2.50.0040.00418.07
8.2.40.0040.00418.16
8.2.30.0050.00317.95
8.2.20.0000.00717.58
8.2.10.0000.00717.70
8.2.00.0040.00417.71
8.1.280.0040.01125.92
8.1.270.0090.00020.39
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0070.00419.52
8.1.230.0040.00817.51
8.1.220.0030.00717.75
8.1.210.0000.00818.77
8.1.200.0090.00017.09
8.1.190.0040.00417.53
8.1.180.0000.00818.88
8.1.170.0040.00418.47
8.1.160.0040.00422.07
8.1.150.0030.00618.66
8.1.140.0030.00617.38
8.1.130.0030.00317.82
8.1.120.0020.00517.33
8.1.110.0050.00217.45
8.1.100.0050.00317.43
8.1.90.0000.00717.39
8.1.80.0000.00717.40
8.1.70.0040.00417.48
8.1.60.0030.00617.60
8.1.50.0000.00717.49
8.1.40.0040.00417.51
8.1.30.0080.00017.47
8.1.20.0000.00817.66
8.1.10.0030.00617.66
8.1.00.0000.00817.43
8.0.300.0040.00418.77
8.0.290.0080.00016.75
8.0.280.0050.00318.47
8.0.270.0000.00817.33
8.0.260.0070.00016.74
8.0.250.0000.00716.96
8.0.240.0000.00816.87
8.0.230.0000.00816.91
8.0.220.0070.00016.82
8.0.210.0080.00016.90
8.0.200.0030.00316.89
8.0.190.0070.00016.93
8.0.180.0030.00516.86
8.0.170.0030.00616.93
8.0.160.0050.00316.77
8.0.150.0000.00716.81
8.0.140.0080.00316.89
8.0.130.0060.00013.34
8.0.120.0040.00416.83
8.0.110.0040.00416.92
8.0.100.0000.00716.80
8.0.90.0000.00716.94
8.0.80.0090.00916.96
8.0.70.0050.00216.87
8.0.60.0000.00716.69
8.0.50.0050.00216.79
8.0.30.0140.00417.01
8.0.20.0100.00917.40
8.0.10.0040.00417.10
8.0.00.0140.00516.75
7.4.330.0060.00015.00
7.4.320.0070.00016.60
7.4.300.0000.00616.66
7.4.290.0070.00016.62
7.4.280.0000.00816.36
7.4.270.0030.00316.52
7.4.260.0030.00316.50
7.4.250.0000.00716.45
7.4.240.0030.00316.60
7.4.230.0000.00816.50
7.4.220.0100.01616.55
7.4.210.0070.00716.68
7.4.200.0050.00316.45
7.4.190.0040.00416.77
7.4.160.0070.01016.64
7.4.150.0040.01417.40
7.4.140.0140.00617.86
7.4.130.0070.01116.68
7.4.120.0100.00716.44
7.4.110.0090.00916.58
7.4.100.0120.00916.43
7.4.90.0150.00816.54
7.4.80.0070.01019.39
7.4.70.0100.00716.75
7.4.60.0080.00816.29
7.4.50.0040.00416.43
7.4.40.0030.01322.77
7.4.30.0090.00616.46
7.4.00.0030.01314.78
7.3.330.0000.00613.23
7.3.320.0030.00313.33
7.3.310.0040.00416.27
7.3.300.0000.00716.42
7.3.290.0130.00616.42
7.3.280.0060.01116.34
7.3.270.0150.00317.40
7.3.260.0060.01216.42
7.3.250.0160.00516.40
7.3.240.0070.01316.39
7.3.230.0090.00816.40
7.3.210.0070.01016.71
7.3.200.0100.00619.39
7.3.190.0140.00616.34
7.3.180.0090.00916.37
7.3.170.0060.00916.43
7.3.160.0080.00816.50
7.3.120.0030.01014.88
7.3.10.0070.01016.78
7.3.00.0030.01016.70
7.2.330.0110.01116.41
7.2.320.0100.00716.82
7.2.310.0060.01116.80
7.2.300.0030.01316.70
7.2.290.0030.01316.65
7.2.130.0130.00316.97
7.2.120.0060.00916.62
7.2.110.0030.01016.96
7.2.100.0080.00416.65
7.2.90.0060.00617.09
7.2.80.0040.00817.18
7.2.70.0100.00316.68
7.2.60.0120.00016.84
7.2.50.0000.01516.97
7.2.40.0000.01116.79
7.2.30.0100.00317.05
7.2.20.0040.01116.73
7.2.10.0030.00717.05
7.2.00.0070.00716.98
7.1.250.0000.01115.59
7.1.240.0000.01515.63
7.1.230.0000.01015.66
7.1.220.0040.00815.65
7.1.210.0060.00615.84
7.1.200.0120.00015.82
7.1.190.0060.00615.68
7.1.180.0060.00615.80
7.1.170.0000.01215.71
7.1.160.0060.00315.44
7.1.150.0070.00715.95
7.1.140.0100.00315.73
7.1.130.0090.00615.93
7.1.120.0060.00615.75
7.1.110.0060.00915.77
7.1.100.0070.00715.89
7.1.90.0030.00615.77
7.1.80.0060.00915.71
7.1.70.0100.00716.43
7.1.60.0060.01317.61
7.1.50.0070.00716.36
7.1.40.0070.00315.93
7.1.30.0090.00615.60
7.1.20.0090.00315.65
7.1.10.0040.00415.74
7.1.00.0030.02319.07
7.0.330.0060.00615.55
7.0.320.0060.01115.13
7.0.310.0080.00415.20
7.0.300.0000.01115.21
7.0.290.0060.00615.05
7.0.280.0060.00315.26
7.0.270.0030.01015.38
7.0.260.0030.00615.21
7.0.250.0030.00715.18
7.0.240.0080.00615.51
7.0.230.0030.01015.57
7.0.220.0080.00315.48
7.0.210.0050.00515.43
7.0.200.0090.00716.19
7.0.190.0040.00815.39
7.0.180.0040.00715.15
7.0.170.0060.00615.51
7.0.160.0030.00915.29
7.0.150.0120.00315.32
7.0.140.0030.03618.77
7.0.130.0140.00015.29
7.0.120.0070.00715.23
7.0.110.0070.00715.53
7.0.100.0000.01515.24
7.0.90.0070.00715.31
7.0.80.0040.00415.30
7.0.70.0060.00615.35
7.0.60.0070.04518.48
7.0.50.0030.04016.66
7.0.40.0050.04616.85
7.0.30.0180.02816.76
7.0.20.0200.04316.75
7.0.10.0130.04316.87
7.0.00.0080.03116.90
5.6.380.0070.00714.21
5.6.370.0100.00314.22
5.6.360.0060.00614.45
5.6.350.0070.00414.39
5.6.340.0150.00314.37
5.6.330.0040.01114.39
5.6.320.0140.00013.95
5.6.310.0040.00814.66
5.6.300.0030.00614.14
5.6.290.0000.01514.08
5.6.280.0050.04017.57
5.6.270.0070.01014.38
5.6.260.0030.00614.46
5.6.250.0030.00614.28
5.6.240.0140.00314.04
5.6.230.0000.01514.14
5.6.220.0060.00314.46
5.6.210.0070.02217.55
5.6.200.0020.02516.30
5.6.190.0080.04417.48
5.6.180.1280.02317.23
5.6.170.0150.04417.38
5.6.160.0070.02517.35
5.6.150.0050.04216.16
5.6.140.0040.02616.25
5.6.130.0110.04016.31
5.6.120.0130.03217.43
5.6.110.0080.04617.65
5.6.100.0130.03817.72
5.6.90.0180.03217.59
5.6.80.0100.04217.50
5.6.70.0000.01514.34
5.6.60.0030.01014.59
5.6.50.0040.00814.34
5.6.40.0040.01114.11
5.6.30.0060.00614.19
5.6.20.0030.01014.31
5.6.10.0070.00714.45
5.6.00.0060.00614.15
5.5.380.0030.00711.07
5.5.370.0060.00610.99
5.5.360.0100.00311.02
5.5.350.0020.04215.63
5.5.340.0090.02314.71
5.5.330.0050.04615.99
5.5.320.0150.03915.83
5.5.310.0200.03715.52
5.5.300.0080.04114.59
5.5.290.0030.04814.50
5.5.280.0030.03315.92
5.5.270.0050.04116.13
5.5.260.0080.02815.92
5.5.250.0050.04515.85
5.5.240.0030.02015.57
5.5.230.0000.00710.88
5.5.220.0070.00410.74
5.5.210.0070.00010.93
5.5.200.0040.00810.84
5.5.190.0000.00910.82
5.5.180.0040.00711.16
5.5.170.0030.01010.96
5.5.160.0030.00911.15
5.5.150.0000.01010.78
5.5.140.0110.00010.89
5.5.130.0000.00810.82
5.5.120.0080.00411.09
5.5.110.0030.00910.91
5.5.100.0080.00411.12
5.5.90.0030.00710.99
5.5.80.0000.01211.14
5.5.70.0030.00711.15
5.5.60.0070.00710.79
5.5.50.0030.00311.25
5.5.40.0030.00911.18
5.5.30.0040.00711.29
5.5.20.0000.00611.18
5.5.10.0070.00310.98
5.5.00.0000.01211.13
5.4.450.0100.03215.21
5.4.440.0070.03415.37
5.4.430.0140.02715.27
5.4.420.0080.03315.02
5.4.410.0100.02915.09
5.4.400.0380.03214.82
5.4.390.0530.03814.95
5.4.380.0170.03014.85
5.4.370.0130.02515.02
5.4.360.0110.03414.83
5.4.350.0060.02011.38
5.4.340.0060.02311.44
5.4.330.0030.00311.01
5.4.320.0070.02311.74
5.4.310.0060.02311.79
5.4.300.0060.02311.62
5.4.290.0050.02511.75
5.4.280.0030.02411.69
5.4.270.0080.01811.47
5.4.260.0060.02211.86
5.4.250.0050.04014.86
5.4.240.0030.03814.99
5.4.230.0070.02715.02
5.4.220.0070.02815.08
5.4.210.0080.02915.13
5.4.200.0050.03215.03
5.4.190.0070.03015.02
5.4.180.0100.03014.92
5.4.170.0050.03614.97
5.4.160.0030.04215.00
5.4.150.0110.03115.01
5.4.140.0080.03413.84
5.4.130.0080.03013.82
5.4.120.0100.02313.74
5.4.110.0050.02913.75
5.4.100.0050.02813.69
5.4.90.0020.02813.82
5.4.80.0030.03013.77
5.4.70.0100.02813.82
5.4.60.0080.02313.87
5.4.50.0100.02213.89
5.4.40.0120.02313.57
5.4.30.0050.03313.77
5.4.20.0050.02713.80
5.4.10.0020.03513.79
5.4.00.0020.03213.47
5.3.290.0070.02311.64
5.3.280.0030.03012.58
5.3.270.0050.02812.69
5.3.260.0070.03512.56
5.3.250.0070.02712.59
5.3.240.0020.03912.57
5.3.230.0050.02912.63
5.3.220.0050.02712.58
5.3.210.0070.03012.58
5.3.200.0020.03112.47
5.3.190.0080.02512.55
5.3.180.0100.02312.53
5.3.170.0020.03212.61
5.3.160.0040.03212.67
5.3.150.0070.02712.63
5.3.140.0030.03012.48
5.3.130.0070.02812.54
5.3.120.0050.03112.64
5.3.110.0020.03212.61
5.3.100.0090.02612.42
5.3.90.0060.02512.47
5.3.80.0090.02412.33
5.3.70.0050.03012.30
5.3.60.0080.03312.41
5.3.50.0000.03212.37
5.3.40.0040.02812.19
5.3.30.0050.02612.31
5.3.20.0030.03112.14
5.3.10.0030.03612.15
5.3.00.0070.02812.05
5.2.170.0060.02810.36
5.2.160.0080.01810.17
5.2.150.0060.02610.30
5.2.140.0040.02410.21
5.2.130.0050.02310.22
5.2.120.0030.02210.21
5.2.110.0050.03210.09
5.2.100.0030.02310.01
5.2.90.0030.02410.29
5.2.80.0070.02110.10
5.2.70.0030.03010.27
5.2.60.0050.02310.08
5.2.50.0100.02710.15
5.2.40.0030.02310.17
5.2.30.0030.0259.97
5.2.20.0000.02610.06
5.2.10.0060.0219.93
5.2.00.0030.0239.76
5.1.60.0040.0209.34
5.1.50.0070.0159.34
5.1.40.0020.0219.36
5.1.30.0050.0279.46
5.1.20.0050.0229.40
5.1.10.0050.0249.34
5.1.00.0030.0219.39
5.0.50.0060.0139.34
5.0.40.0090.0139.34
5.0.30.0040.0229.34
5.0.20.0020.0199.34
5.0.10.0030.0189.34
5.0.00.0020.0329.34
4.4.90.0030.0109.34
4.4.80.0040.0129.34
4.4.70.0030.0119.34
4.4.60.0020.0139.34
4.4.50.0020.0129.34
4.4.40.0020.0279.34
4.4.30.0020.0149.34
4.4.20.0010.0139.34
4.4.10.0020.0129.34
4.4.00.0000.0219.34
4.3.110.0030.0129.34
4.3.100.0040.0099.34
4.3.90.0020.0179.34
4.3.80.0030.0189.34
4.3.70.0030.0179.34
4.3.60.0040.0129.34
4.3.50.0040.0119.34
4.3.40.0020.0189.34
4.3.30.0030.0129.34
4.3.20.0050.0109.34
4.3.10.0000.0179.34
4.3.00.0040.0127.63

preferences:
43.33 ms | 401 KiB | 5 Q