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; } } class A5 { function foo($a, $b) { $a + $b; } } class A6 { 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; $count = 7; $objects = array(new A0, new A1, new A2, new A3, new A4, new A5, new A6) ; $t = microtime (true); for ($j=0; $j<$count; $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<$count; $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<$count; $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.10.0190.00416.44
7.3.00.0260.00016.24
7.2.130.0090.00916.88
7.2.120.0060.01216.81
7.2.110.0060.00616.59
7.2.100.0100.00716.78
7.2.90.0030.01416.76
7.2.80.0000.01816.91
7.2.70.0040.01116.55
7.2.60.0060.01516.90
7.2.50.0150.00916.98
7.2.40.0070.01016.71
7.2.30.0030.01416.60
7.2.20.0040.00816.72
7.2.10.0150.00616.62
7.2.00.0110.00918.04
7.1.250.0070.01015.33
7.1.70.0030.00517.30
7.1.60.0110.01519.70
7.1.50.0030.01017.07
7.1.00.0070.07322.27
7.0.200.0090.00614.97
7.0.140.0130.06322.09
7.0.60.0070.05020.05
7.0.50.0100.07017.93
7.0.40.0130.07720.30
7.0.30.0470.07020.20
7.0.20.0230.04020.07
7.0.10.0230.07320.23
7.0.00.0030.04720.22
5.6.280.0030.07720.93
5.6.210.0070.07320.63
5.6.200.0070.06018.28
5.6.190.0000.05720.50
5.6.180.3430.05020.61
5.6.170.0200.04320.71
5.6.160.0130.06720.48
5.6.150.0070.07718.21
5.6.140.0030.04018.20
5.6.130.0030.09318.18
5.6.120.0070.06721.17
5.6.110.0100.05320.99
5.6.100.0070.08021.00
5.6.90.0030.07021.03
5.6.80.0170.07320.38
5.6.70.4430.05320.40
5.5.350.0270.07720.43
5.5.340.0030.08017.94
5.5.330.0100.06320.29
5.5.320.1700.05720.25
5.5.310.0130.04320.30
5.5.300.0000.04717.94
5.5.290.0200.03717.93
5.5.280.0170.07720.80
5.5.270.0000.07020.89
5.5.260.0170.07320.91
5.5.250.0170.06020.64
5.5.240.0230.03720.21
5.4.450.0530.04728.29
5.4.440.0370.04728.28
5.4.430.0430.04728.28
5.4.420.0370.03328.28
5.4.410.0270.04028.28
5.4.400.0200.03328.28
5.4.390.0730.04327.24
5.4.380.0170.05018.78
5.4.370.0100.05718.63
5.4.360.0130.05318.51
5.4.350.0200.06018.58
5.4.340.0200.04718.76
5.4.320.0070.03612.53
5.4.310.0080.04012.53
5.4.300.0050.04012.53
5.4.290.0060.04212.53
5.4.280.0060.04112.43
5.4.270.0100.03512.42
5.4.260.0100.04112.43
5.4.250.0040.04412.43
5.4.240.0090.03912.42
5.4.230.0040.04112.42
5.4.220.0070.03612.42
5.4.210.0050.03812.42
5.4.200.0030.04412.42
5.4.190.0070.04112.41
5.4.180.0080.03712.42
5.4.170.0040.04312.42
5.4.160.0080.04412.42
5.4.150.0080.03912.41
5.4.140.0090.04012.10
5.4.130.0110.03912.08
5.4.120.0070.04112.05
5.4.110.0090.03912.04
5.4.100.0060.04012.04
5.4.90.0050.04412.04
5.4.80.0050.04412.04
5.4.70.0060.03912.04
5.4.60.0070.04012.04
5.4.50.0050.04112.04
5.4.40.0030.04112.02
5.4.30.0070.03712.02
5.4.20.0080.04912.02
5.4.10.0080.04812.02
5.4.00.0110.03911.52
5.3.290.0050.04312.80
5.3.280.0070.04312.73
5.3.270.0080.04112.73
5.3.260.0090.04012.73
5.3.250.0090.04312.73
5.3.240.0150.03312.73
5.3.230.0080.04812.72
5.3.220.0090.05012.70
5.3.210.0080.04312.69
5.3.200.0040.04912.69
5.3.190.0050.04212.69
5.3.180.0100.03812.69
5.3.170.0070.04112.69
5.3.160.0090.03912.69
5.3.150.0070.03912.69
5.3.140.0100.03412.68
5.3.130.0140.03912.67
5.3.120.0070.05212.67
5.3.110.0060.04012.67
5.3.100.0050.04012.16
5.3.90.0050.03812.14
5.3.80.0070.03712.13
5.3.70.0090.03412.13
5.3.60.0050.04012.11
5.3.50.0080.03612.06
5.3.40.0070.04212.06
5.3.30.0070.03712.03
5.3.20.0060.03611.80
5.3.10.0040.03911.76
5.3.00.0030.04011.75
5.2.170.0050.0329.27
5.2.160.0050.0309.28
5.2.150.0040.0359.28
5.2.140.0030.0339.27
5.2.130.0070.0279.23
5.2.120.0060.0289.23
5.2.110.0040.0319.24
5.2.100.0040.0309.23
5.2.90.0060.0299.23
5.2.80.0020.0359.23
5.2.70.0070.0329.22
5.2.60.0150.0339.19
5.2.50.0080.0299.15
5.2.40.0050.0319.13
5.2.30.0080.0299.10
5.2.20.0040.0329.09
5.2.10.0040.0309.02
5.2.00.0020.0328.89
5.1.60.0050.0308.17
5.1.50.0030.0338.17
5.1.40.0060.0258.15
5.1.30.0050.0278.49
5.1.20.0060.0278.52
5.1.10.0060.0258.24
5.1.00.0020.0288.24
5.0.50.0060.0196.73
5.0.40.0050.0196.59
5.0.30.0040.0326.41
5.0.20.0020.0226.39
5.0.10.0040.0216.37
5.0.00.0050.0316.36
4.4.90.0030.0234.78
4.4.80.0050.0214.75
4.4.70.0020.0234.75
4.4.60.0050.0204.75
4.4.50.0040.0234.77
4.4.40.0060.0324.73
4.4.30.0040.0164.76
4.4.20.0060.0204.85
4.4.10.0020.0184.85
4.4.00.0030.0334.76
4.3.110.0010.0214.67
4.3.100.0040.0174.66
4.3.90.0020.0184.64
4.3.80.0070.0224.64
4.3.70.0060.0154.64
4.3.60.0030.0154.64
4.3.50.0030.0164.64
4.3.40.0050.0234.58
4.3.30.0010.0193.39
4.3.20.0040.0163.37
4.3.10.0050.0143.32
4.3.00.0070.01726.89

preferences:
35.67 ms | 401 KiB | 5 Q