3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function dynamicMethod($a) { return $a + 1; } public static function staticMethod($a) { return $a + 1; } public function __invoke($a) { return $a + 1; } } $object = new Test(); ///////////////////////// $function = function ($a) { return $a + 1; }; function testFunction($a) { return $a + 1; } // env echo phpversion(), " ", PHP_OS, PHP_EOL; // dynamic $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = $object->dynamicMethod($i); } echo "dynamic: ", microtime(true) - $startTime, PHP_EOL; // dynamic call_user_func $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = call_user_func_array(array($object, 'dynamicMethod'), array($i)); } echo "call_user_func_array: ", microtime(true) - $startTime, PHP_EOL; // static $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = Test::staticMethod($i); } echo "static: ", microtime(true) - $startTime, PHP_EOL; // invoke $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = $object($i); } echo "invoke: ", microtime(true) - $startTime, PHP_EOL; // function $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = testFunction($i); } echo "function: ", microtime(true) - $startTime, PHP_EOL; // anonymous function $startTime = microtime(true); for ($i = 0; $i < 100000;) { $i = $function($i); } echo "anonymous function: ", microtime(true) - $startTime, PHP_EOL;

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.10.0070.07515.16
7.4.00.0100.05815.19
7.3.130.0070.07814.54
7.3.120.0070.06714.86
7.3.110.0070.06814.84
7.3.100.0060.04914.87
7.3.90.0080.05514.87
7.3.80.0080.05814.99
7.3.70.0070.05014.87
7.3.60.0060.05314.92
7.3.50.0090.05014.77
7.3.40.0060.05114.85
7.3.30.0070.05014.88
7.3.20.0040.05316.52
7.3.10.0030.05216.70
7.3.00.0030.05216.68
7.2.260.0100.05415.23
7.2.250.0080.06915.18
7.2.240.0080.06215.19
7.2.230.0050.05715.34
7.2.220.0020.05815.22
7.2.210.0070.05414.91
7.2.200.0110.05114.95
7.2.190.0080.05115.11
7.2.180.0070.05214.99
7.2.170.0060.05614.92
7.2.160.0080.05415.13
7.2.150.0020.05916.92
7.2.140.0100.05016.88
7.2.130.0120.04716.97
7.2.120.0110.04917.00
7.2.110.0080.05316.93
7.2.100.0050.05616.96
7.2.90.0050.05616.89
7.2.80.0050.05516.93
7.2.70.0030.06516.97
7.2.60.0020.05717.09
7.2.50.0080.04817.06
7.2.40.0050.05416.99
7.2.30.0030.05417.09
7.2.20.0030.05617.08
7.2.10.0050.05216.97
7.2.00.0030.05417.77
7.1.330.0030.08615.85
7.1.320.0070.08115.80
7.1.310.0070.09115.90
7.1.300.0050.08215.82
7.1.290.0080.08615.74
7.1.280.0070.08115.73
7.1.270.0010.08515.83
7.1.260.0040.08115.80
7.1.250.0030.08816.00
7.1.240.0030.11215.68
7.1.230.0000.08415.79
7.1.220.0000.08615.55
7.1.210.0070.09015.86
7.1.200.0030.08515.80
7.1.190.0000.09115.64
7.1.180.0030.09415.83
7.1.170.0030.08315.94
7.1.160.0030.08315.83
7.1.150.0070.10915.78
7.1.140.0070.08415.79
7.1.130.0000.09115.83
7.1.120.0030.08615.93
7.1.110.0000.08615.84
7.1.100.0070.10015.57
7.1.90.0000.09115.95
7.1.80.0030.07915.64
7.1.70.0050.05916.54
7.1.60.0050.08617.47
7.1.50.0070.07316.46
7.1.40.0030.08015.93
7.1.30.0000.08415.79
7.1.20.0070.08115.90
7.1.10.0030.08315.71
7.1.00.0100.11419.08
7.0.330.0100.08615.50
7.0.320.0030.08515.25
7.0.310.0030.08515.23
7.0.300.0070.08315.38
7.0.290.0030.08615.47
7.0.280.0030.10115.47
7.0.270.0000.08815.60
7.0.260.0030.08315.25
7.0.250.0030.08715.29
7.0.240.0030.10815.57
7.0.230.0070.08315.40
7.0.220.0070.08315.47
7.0.210.0100.08615.45
7.0.200.0050.06416.14
7.0.190.0070.08215.51
7.0.180.0000.09015.45
7.0.170.0030.09015.23
7.0.160.0030.08415.32
7.0.150.0030.08215.47
7.0.140.0030.11118.88
7.0.130.0130.11715.55
7.0.120.0030.09415.34
7.0.110.0030.08515.18
7.0.100.0100.08115.23
7.0.90.0070.08215.51
7.0.80.0090.11115.56
7.0.70.0100.09615.30
7.0.60.0020.07918.56
7.0.50.0050.07418.74
7.0.40.0020.09216.82
7.0.30.0030.11816.58
7.0.20.0080.10416.84
7.0.10.0080.10316.74
7.0.00.0070.10416.68
5.6.400.0030.21114.18
5.6.390.0000.26314.52
5.6.380.0100.20214.02
5.6.370.0160.19714.27
5.6.360.0000.22714.27
5.6.350.0070.20214.18
5.6.340.0000.20714.27
5.6.330.0030.22514.25
5.6.320.0030.23314.04
5.6.310.0100.21414.50
5.6.300.0030.23414.63
5.6.290.0070.21514.58
5.6.280.0030.25314.07
5.6.270.0030.22514.63
5.6.260.0070.22914.43
5.6.250.0100.21714.28
5.6.240.0030.22414.39
5.6.230.0100.21814.36
5.6.220.0000.23414.14
5.6.210.0020.17517.43
5.6.200.0020.17517.67
5.6.190.0030.17717.87
5.6.180.0030.19217.71
5.6.170.0030.22217.64
5.6.160.0070.20917.67
5.6.150.0050.20317.73
5.6.140.0070.21217.67
5.6.130.0030.21517.82
5.6.120.0080.23117.68
5.6.110.0020.23217.86
5.6.100.0050.21717.82
5.6.90.0070.20417.65
5.6.80.0080.20317.26
5.6.70.0070.23317.26
5.6.60.0050.22117.39
5.6.50.0030.20317.41
5.6.40.0080.21217.37
5.6.30.0030.20817.31
5.6.20.0000.23417.33
5.6.10.0070.21317.34
5.6.00.0050.21217.40
5.5.380.0030.25314.40
5.5.370.0100.21514.42
5.5.360.0030.22214.02
5.5.350.0020.18017.44
5.5.340.0020.16817.55
5.5.330.0050.17817.61
5.5.320.0020.21817.42
5.5.310.0080.19817.59
5.5.300.0030.22317.56
5.5.290.0080.20217.54
5.5.280.0030.21117.63
5.5.270.0050.22217.60
5.5.260.0020.20917.63
5.5.250.0100.19917.52
5.5.240.0050.20517.28
5.5.230.0070.22117.35
5.5.220.0000.21017.32
5.5.210.0050.21617.25
5.5.200.0080.19817.38
5.5.190.0000.23817.24
5.5.180.0030.22317.05
5.5.170.0030.24014.02
5.5.160.0050.18717.38
5.5.150.0080.23817.14
5.5.140.0020.23517.14
5.5.130.0020.21217.39
5.5.120.0030.19917.20
5.5.110.0050.21617.20
5.5.100.0050.21616.97
5.5.90.0070.21617.12
5.5.80.0070.24817.06
5.5.70.0030.24517.08
5.5.60.0070.21017.25
5.5.50.0020.20517.11
5.5.40.0020.21417.03
5.5.30.0050.24317.27
5.5.20.0030.23317.16
5.5.10.0120.20117.14
5.5.00.0070.18917.07
5.4.450.0070.22815.37
5.4.440.0020.21915.14
5.4.430.0030.20015.35
5.4.420.0020.21015.21
5.4.410.0020.18715.23
5.4.400.0030.20214.91
5.4.390.0020.21215.23
5.4.380.0000.22014.86
5.4.370.0030.21615.12
5.4.360.0030.22415.02
5.4.350.0070.20114.90
5.4.340.0030.22915.12
5.4.330.0000.24411.20
5.4.320.0030.22114.98
5.4.310.0030.23215.14
5.4.300.0030.20115.22
5.4.290.0020.21814.96
5.4.280.0070.21115.03
5.4.270.0080.20514.95
5.4.260.0030.23615.10
5.4.250.0000.24015.10
5.4.240.0030.22114.97
5.4.230.0050.21715.06
5.4.220.0050.21015.03
5.4.210.0070.20015.03
5.4.200.0030.21114.94
5.4.190.0030.21115.02
5.4.180.0050.22915.12
5.4.170.0070.20615.15
5.4.160.0030.17714.98
5.4.150.0030.18615.00
5.4.140.0020.22113.68
5.4.130.0000.23213.89
5.4.120.0050.21413.75
5.4.110.0020.22013.76
5.4.100.0020.21313.78
5.4.90.0020.24313.86
5.4.80.0050.22913.81
5.4.70.0080.23413.78
5.4.60.0020.23013.82
5.4.50.0030.21613.74
5.4.40.0080.20613.59
5.4.30.0030.24013.78
5.4.20.0070.20713.63
5.4.10.0020.20813.76
5.4.00.0030.19513.52
5.3.290.0050.26112.67
5.3.280.0020.25112.58
5.3.270.0030.27612.72
5.3.260.0030.25012.63
5.3.250.0050.24212.71
5.3.240.0070.25512.53
5.3.230.0030.25112.49
5.3.220.0020.26812.56
5.3.210.0030.25512.39
5.3.200.0100.28412.54
5.3.190.0000.25312.59
5.3.180.0020.26012.54
5.3.170.0020.25012.62
5.3.160.0070.24312.70
5.3.150.0030.25312.62
5.3.140.0020.27512.60
5.3.130.0030.25212.64
5.3.120.0020.26412.59
5.3.110.0000.25612.49
5.3.100.0020.25212.25
5.3.90.0050.24312.32
5.3.80.0020.25612.25
5.3.70.0050.24612.16
5.3.60.0070.26712.37
5.3.50.0050.26012.33
5.3.40.0020.26312.31
5.3.30.0000.26412.32
5.3.20.0050.25812.15
5.3.10.0020.23411.97
5.3.00.0050.25612.03
5.2.170.0030.05011.17
5.2.160.0000.06311.16
5.2.150.0000.04711.21
5.2.140.0000.05711.20
5.2.130.0000.06311.16
5.2.120.0030.05711.17
5.2.110.0000.06011.11
5.2.100.0070.06010.96
5.2.90.0030.06011.21
5.2.80.0030.06010.95
5.2.70.0000.05311.16
5.2.60.0070.04711.17
5.2.50.0030.06011.14
5.2.40.0070.05311.00
5.2.30.0070.05711.00
5.2.20.0030.06010.81
5.2.10.0000.05710.87
5.2.00.0070.05310.70
5.1.60.0070.0379.84
5.1.50.0030.05310.00
5.1.40.0030.04310.00
5.1.30.0000.05710.38
5.1.20.0070.05010.44
5.1.10.0070.05310.13
5.1.00.0100.04310.14
5.0.50.0030.0409.12
5.0.40.0030.0409.12
5.0.30.0030.0639.12
5.0.20.0030.0439.12
5.0.10.0030.0479.12
5.0.00.0070.0439.12
4.4.90.0030.0309.12
4.4.80.0070.0279.12
4.4.70.0000.0379.12
4.4.60.0000.0379.12
4.4.50.0070.0239.12
4.4.40.0000.0579.12
4.4.30.0000.0379.12
4.4.20.0030.0339.12
4.4.10.0030.0309.12
4.4.00.0030.0539.12
4.3.110.0000.0379.12
4.3.100.0030.0339.12
4.3.90.0000.0379.12
4.3.80.0000.0579.12
4.3.70.0030.0309.12
4.3.60.0000.0379.12
4.3.50.0070.0309.12
4.3.40.0030.0479.12
4.3.30.0030.0379.12
4.3.20.0030.0339.12
4.3.10.0030.0339.12
4.3.00.0000.0379.12

preferences:
39.77 ms | 401 KiB | 5 Q