3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function foo($a, $b) {} } $max = 5*1e1; $object = new A; $t = microtime (true); for ($i=0; $i<$max; $i++) { $object->foo(1, 'foo'); } echo $max.' x A::foo: '.round((microtime(true)-$t)*1e6, 2)." µs\n"; $t = microtime (true); for ($i=0; $i<$max; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } echo $max.' x call_user_func_array: '.round((microtime(true)-$t)*1e6, 2)." µs\n"; $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } echo $max.' x ReflectionMethod::invokeArgs: '.round((microtime(true)-$t)*1e6, 2)." µs\n"; $t = microtime (true); for ($j=0; $j<$max/10; $j++) { $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<10; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } } echo ($max/10).' x (10 x ReflectionMethod::invokeArgs): '.round((microtime(true)-$t)*1e6, 2)." µs\n";

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.4.00.0110.00714.73
7.3.120.0080.01014.90
7.3.110.0050.01115.09
7.3.100.0050.00814.78
7.3.90.0050.00914.83
7.3.80.0080.00614.99
7.3.70.0060.00614.85
7.3.60.0070.00614.96
7.3.50.0030.01214.74
7.3.40.0030.00814.70
7.3.30.0050.00914.88
7.3.20.0030.01316.72
7.3.10.0100.00616.74
7.3.00.0060.01016.75
7.2.250.0090.00914.87
7.2.240.0050.01415.24
7.2.230.0050.01015.23
7.2.220.0020.01015.22
7.2.210.0040.01114.96
7.2.200.0060.01114.98
7.2.190.0040.01015.19
7.2.180.0060.01115.00
7.2.170.0030.01215.10
7.2.160.0060.00915.17
7.2.150.0060.00916.85
7.2.140.0090.00916.82
7.2.130.0000.01217.04
7.2.120.0060.00616.93
7.2.110.0040.01117.03
7.2.100.0100.00316.90
7.2.90.0120.00417.04
7.2.80.0100.01016.96
7.2.70.0030.01317.16
7.2.60.0070.00716.93
7.2.50.0080.00817.01
7.2.40.0040.00816.96
7.2.30.0030.00717.01
7.2.20.0090.00617.09
7.2.10.0080.00817.07
7.2.00.0080.00518.38
7.1.330.0050.01115.86
7.1.320.0050.00815.72
7.1.310.0070.00715.88
7.1.300.0060.01015.77
7.1.290.0060.00815.70
7.1.280.0050.00915.82
7.1.270.0060.00615.84
7.1.260.0070.00615.82
7.1.250.0030.00915.82
7.1.70.0040.00417.20
7.1.60.0120.00017.21
7.1.50.0100.01017.11
7.1.00.0070.07322.30
7.0.200.0060.00616.93
7.0.140.0030.07322.17
7.0.60.0030.08019.86
7.0.50.0030.04017.88
7.0.40.0130.08020.14
7.0.30.0600.06020.34
7.0.20.0270.07720.21
7.0.10.0030.05320.07
7.0.00.0030.04020.12
5.6.280.0000.08021.05
5.6.210.0000.07020.59
5.6.200.0170.07018.20
5.6.190.0070.04020.67
5.6.180.0030.04320.52
5.6.170.0230.04320.73
5.6.160.0030.05720.57
5.6.150.0030.04318.16
5.6.140.0100.07718.15
5.6.130.0030.04718.27
5.6.120.0070.05021.02
5.6.110.0070.08321.00
5.6.100.0100.07020.97
5.6.90.0070.04721.01
5.6.80.0070.05020.45
5.6.70.4430.03320.38
5.5.350.0000.07720.43
5.5.340.0070.06017.99
5.5.330.0130.03320.21
5.5.320.0470.06020.51
5.5.310.0270.07320.50
5.5.300.0070.07717.98
5.5.290.0100.04317.95
5.5.280.0100.07720.78
5.5.270.0130.07720.77
5.5.260.0200.06720.88
5.5.250.0030.07020.66
5.5.240.0030.04020.28
5.4.450.0270.04728.29
5.4.440.0430.03728.28
5.4.430.0870.04328.28
5.4.420.0200.04028.28
5.4.410.0370.04328.28
5.4.400.0500.03027.56
5.4.390.0330.03027.24
5.4.380.0170.05318.73
5.4.370.0200.04718.78
5.4.360.0130.05018.59
5.4.350.0130.05318.74
5.4.340.0170.05018.57
5.4.320.0050.03812.52
5.4.310.0060.03912.52
5.4.300.0080.03512.52
5.4.290.0030.04112.52
5.4.280.0070.03512.41
5.4.270.0040.03812.41
5.4.260.0050.04212.41
5.4.250.0090.04512.41
5.4.240.0080.04212.41
5.4.230.0100.04512.41
5.4.220.0110.05012.41
5.4.210.0050.06112.41
5.4.200.0150.05312.40
5.4.190.0080.04912.40
5.4.180.0120.04612.40
5.4.170.0110.05312.42
5.4.160.0120.03712.41
5.4.150.0060.04312.40
5.4.140.0060.05212.09
5.4.130.0050.05012.08
5.4.120.0080.04612.04
5.4.110.0060.04712.03
5.4.100.0100.04712.04
5.4.90.0060.04412.03
5.4.80.0040.04512.03
5.4.70.0090.04412.03
5.4.60.0040.04912.03
5.4.50.0040.04812.02
5.4.40.0060.04712.02
5.4.30.0080.04112.01
5.4.20.0120.05212.02
5.4.10.0080.05812.03
5.4.00.0070.04611.50
5.3.290.0060.04012.80
5.3.280.0090.04812.71
5.3.270.0120.04812.73
5.3.260.0100.04412.72
5.3.250.0100.04212.72
5.3.240.0070.04412.72
5.3.230.0120.03912.71
5.3.220.0070.04012.68
5.3.210.0070.04312.68
5.3.200.0120.04312.68
5.3.190.0120.03612.68
5.3.180.0080.03612.67
5.3.170.0050.04312.68
5.3.160.0070.03812.68
5.3.150.0110.03512.68
5.3.140.0080.03612.66
5.3.130.0060.04612.66
5.3.120.0060.04412.66
5.3.110.0110.04612.66
5.3.100.0090.04412.14
5.3.90.0080.03512.13
5.3.80.0040.04012.12
5.3.70.0080.03912.12
5.3.60.0090.04012.10
5.3.50.0050.03912.05
5.3.40.0100.03512.05
5.3.30.0090.04512.00
5.3.20.0090.03511.80
5.3.10.0080.03511.75
5.3.00.0050.04011.74
5.2.170.0030.0319.26
5.2.160.0030.0329.26
5.2.150.0060.0319.26
5.2.140.0020.0349.25
5.2.130.0050.0309.22
5.2.120.0060.0289.21
5.2.110.0070.0309.23
5.2.100.0050.0409.21
5.2.90.0100.0299.22
5.2.80.0040.0369.21
5.2.70.0070.0389.21
5.2.60.0090.0289.16
5.2.50.0090.0329.14
5.2.40.0070.0329.11
5.2.30.0070.0319.08
5.2.20.0060.0349.07
5.2.10.0040.0329.00
5.2.00.0080.0308.86
5.1.60.0060.0238.14
5.1.50.0050.0258.14
5.1.40.0060.0248.12
5.1.30.0080.0228.47
5.1.20.0070.0298.49
5.1.10.0090.0228.22
5.1.00.0070.0278.22
5.0.50.0100.0176.71
5.0.40.0070.0236.57
5.0.30.0050.0326.38
5.0.20.0060.0196.36
5.0.10.0030.0216.34
5.0.00.0030.0316.34
4.4.90.0060.0134.78
4.4.80.0030.0184.76
4.4.70.0030.0154.75
4.4.60.0030.0194.75
4.4.50.0040.0184.77
4.4.40.0050.0254.71
4.4.30.0020.0184.76
4.4.20.0020.0174.84
4.4.10.0030.0164.85
4.4.00.0020.0334.76
4.3.110.0050.0214.67
4.3.100.0040.0184.67
4.3.90.0030.0144.64
4.3.80.0030.0254.62
4.3.70.0010.0174.63
4.3.60.0030.0164.63
4.3.50.0040.0224.63
4.3.40.0060.0244.58
4.3.30.0030.0213.38
4.3.20.0020.0183.36
4.3.10.0020.0193.32
4.3.00.0000.01726.73

preferences:
34.85 ms | 401 KiB | 5 Q