3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A0 { function foo($a, $b) { $a + $b; } } class A1 { function foo($a, $b) { $a + $b; } } class A2 { function foo($a, $b) { $a + $b; } } class A3 { function foo($a, $b) { $a + $b; } } class A4 { function foo($a, $b) { $a + $b; } } function row($name, $t) { printf("%-40s %8s x 10 µs\n", $name, number_format((microtime(true)-$t)*1e5, 2)); } $max = 5*1e1; $objects = array(new A0, new A1, new A2, new A3, new A4) ; $t = microtime (true); for ($j=0; $j<5; $j++) { for ($i=0; $i<$max; $i++) { $objects[$j]->foo(1, 'foo'); } } row($max.' x A::foo', $t); $t = microtime (true); for ($j=0; $j<5; $j++) { for ($i=0; $i<$max; $i++) { call_user_func_array(array($objects[$j], 'foo'), array(1, 'foo')); } } row($max.' x call_user_func_array', $t); $t = microtime (true); for ($j=0; $j<5; $j++) { $ref = new ReflectionMethod($objects[$j], 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($objects[$j], array(1, 'foo')); } } row($max.' x ReflectionMethod::invokeArgs', $t);

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)
7.3.120.0090.00614.76
7.3.110.0030.01014.66
7.3.100.0000.01114.77
7.3.90.0030.01414.92
7.3.80.0070.01015.09
7.3.70.0110.00314.96
7.3.60.0040.01114.83
7.3.50.0000.01714.92
7.3.40.0120.00814.71
7.3.30.0070.00715.01
7.3.20.0120.00316.63
7.3.10.0060.00616.33
7.3.00.0000.01916.81
7.2.240.0070.01014.81
7.2.230.0070.01015.04
7.2.220.0090.00915.19
7.2.210.0130.00615.05
7.2.200.0030.01315.13
7.2.190.0030.01614.97
7.2.180.0110.00415.20
7.2.170.0090.00914.99
7.2.160.0070.00714.84
7.2.150.0100.00616.93
7.2.140.0030.01016.75
7.2.130.0000.01816.79
7.2.120.0090.00616.70
7.2.110.0120.00616.50
7.2.100.0040.01416.91
7.2.90.0100.00716.96
7.2.80.0040.01116.56
7.2.70.0070.01016.81
7.2.60.0080.00816.87
7.2.50.0030.01016.72
7.2.40.0030.01616.96
7.2.30.0100.01016.84
7.2.20.0030.01416.99
7.2.10.0040.01517.02
7.2.00.0030.01318.23
7.1.330.0030.01415.65
7.1.320.0000.01315.82
7.1.310.0060.01216.17
7.1.300.0120.00315.81
7.1.290.0030.01315.57
7.1.280.0190.00015.96
7.1.270.0080.00815.76
7.1.260.0080.00415.91
7.1.250.0000.01616.02
7.1.70.0000.00817.25
7.1.60.0060.01819.70
7.1.50.0100.01017.02
7.1.00.0030.07722.26
7.0.200.0140.00315.04
7.0.140.0030.07322.23
7.0.60.0130.04719.89
7.0.50.0030.04317.96
7.0.40.0100.06720.10
7.0.30.0530.03720.25
7.0.20.0500.06020.08
7.0.10.0030.09320.20
7.0.00.0000.04320.06
5.6.280.0030.07721.06
5.6.210.0000.08720.72
5.6.200.0170.07318.16
5.6.190.0070.04020.48
5.6.180.0300.05020.64
5.6.170.0130.05320.63
5.6.160.0200.06320.53
5.6.150.0030.07318.17
5.6.140.0000.04718.18
5.6.130.0070.08718.25
5.6.120.0070.08321.02
5.6.110.0070.07320.91
5.6.100.0070.09021.14
5.6.90.0000.06721.15
5.6.80.0130.07720.50
5.6.70.5130.03020.37
5.5.350.0170.08020.34
5.5.340.0070.07318.08
5.5.330.0030.07320.25
5.5.320.4070.04320.25
5.5.310.0170.05020.28
5.5.300.0000.04718.04
5.5.290.0030.04017.93
5.5.280.0030.04320.82
5.5.270.0100.05020.87
5.5.260.0030.07320.88
5.5.250.0100.07020.71
5.5.240.0070.02720.18
5.4.450.0300.05728.29
5.4.440.0100.05328.28
5.4.430.0370.06328.28
5.4.420.0230.04328.28
5.4.410.0230.04028.28
5.4.400.0630.04027.71
5.4.390.0400.04027.24
5.4.380.0070.07018.84
5.4.370.0130.05318.73
5.4.360.0170.07318.84
5.4.350.0100.05718.71
5.4.340.0100.05718.61
5.4.320.0070.03612.53
5.4.310.0070.03712.53
5.4.300.0030.03912.52
5.4.290.0100.03812.52
5.4.280.0090.03212.42
5.4.270.0080.03612.42
5.4.260.0050.04012.43
5.4.250.0070.03812.42
5.4.240.0020.03912.43
5.4.230.0090.03812.41
5.4.220.0060.04212.41
5.4.210.0030.03912.41
5.4.200.0090.03612.42
5.4.190.0050.04312.41
5.4.180.0140.02912.41
5.4.170.0040.03812.42
5.4.160.0060.03612.41
5.4.150.0050.03912.41
5.4.140.0060.03812.09
5.4.130.0070.04212.09
5.4.120.0080.03712.04
5.4.110.0070.03412.04
5.4.100.0090.03212.04
5.4.90.0060.03812.04
5.4.80.0090.03512.04
5.4.70.0020.04012.04
5.4.60.0100.03112.03
5.4.50.0020.03912.03
5.4.40.0060.03412.02
5.4.30.0020.03812.02
5.4.20.0060.03512.02
5.4.10.0030.03712.02
5.4.00.0050.03711.51
5.3.290.0070.03812.80
5.3.280.0020.04112.71
5.3.270.0050.04312.72
5.3.260.0060.04012.73
5.3.250.0070.03712.73
5.3.240.0050.03812.73
5.3.230.0070.03912.72
5.3.220.0060.03612.70
5.3.210.0060.03812.69
5.3.200.0050.03712.69
5.3.190.0060.03712.69
5.3.180.0060.03612.68
5.3.170.0040.03712.69
5.3.160.0100.03112.69
5.3.150.0060.03712.69
5.3.140.0070.03512.67
5.3.130.0070.03912.67
5.3.120.0060.04112.67
5.3.110.0070.03912.67
5.3.100.0090.03412.16
5.3.90.0080.03812.14
5.3.80.0080.03712.13
5.3.70.0070.03712.13
5.3.60.0040.03812.11
5.3.50.0040.03812.05
5.3.40.0030.04012.06
5.3.30.0060.03512.02
5.3.20.0040.03711.80
5.3.10.0050.03511.77
5.3.00.0060.03511.75
5.2.170.0020.0359.26
5.2.160.0030.0309.27
5.2.150.0030.0329.27
5.2.140.0060.0299.27
5.2.130.0060.0359.23
5.2.120.0070.0279.22
5.2.110.0040.0329.23
5.2.100.0090.0379.23
5.2.90.0050.0349.22
5.2.80.0080.0349.23
5.2.70.0050.0339.22
5.2.60.0040.0329.19
5.2.50.0050.0339.16
5.2.40.0100.0369.13
5.2.30.0060.0409.10
5.2.20.0100.0359.09
5.2.10.0060.0389.01
5.2.00.0050.0428.88
5.1.60.0060.0338.16
5.1.50.0080.0338.15
5.1.40.0060.0308.13
5.1.30.0060.0378.48
5.1.20.0050.0398.51
5.1.10.0040.0358.23
5.1.00.0020.0298.24
5.0.50.0040.0206.72
5.0.40.0030.0196.58
5.0.30.0080.0276.40
5.0.20.0050.0206.38
5.0.10.0050.0206.36
5.0.00.0080.0276.34
4.4.90.0030.0164.78
4.4.80.0040.0164.75
4.4.70.0040.0154.75
4.4.60.0030.0164.75
4.4.50.0050.0144.77
4.4.40.0030.0274.71
4.4.30.0050.0154.76
4.4.20.0050.0184.84
4.4.10.0040.0194.85
4.4.00.0040.0254.76
4.3.110.0030.0164.67
4.3.100.0020.0164.67
4.3.90.0020.0174.64
4.3.80.0040.0254.64
4.3.70.0040.0144.63
4.3.60.0050.0124.64
4.3.50.0020.0174.63
4.3.40.0020.0264.57
4.3.30.0000.0183.38
4.3.20.0020.0163.36
4.3.10.0010.0173.31
4.3.00.0030.01726.89

preferences:
25.5 ms | 401 KiB | 5 Q