3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo ', array_walk '.(microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array, array_keys($array)); } echo ', array_map '.(microtime(true) - $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.2.00.0060.01219.58
7.1.70.0000.01316.93
7.1.60.0060.02219.70
7.1.50.0030.01616.99
7.1.00.0100.07322.32
7.0.200.0090.00416.87
7.0.140.0070.07022.09
7.0.100.0000.07319.94
7.0.90.0070.08719.99
7.0.80.0330.06319.88
7.0.70.0200.06719.88
7.0.60.0130.08019.93
7.0.50.0270.09720.21
7.0.40.0070.04320.14
7.0.30.0170.08320.04
7.0.20.0000.07020.13
7.0.10.0070.06720.09
7.0.00.0070.09020.17
5.6.280.0100.07721.03
5.6.250.0030.05720.79
5.6.240.0000.08720.73
5.6.230.0070.09020.72
5.6.220.0070.08020.52
5.6.210.0030.09320.64
5.6.200.0030.09321.18
5.6.190.0030.06321.05
5.6.180.0130.07721.06
5.6.170.0130.05321.08
5.6.160.0130.09021.14
5.6.150.0070.07721.13
5.6.140.0170.08321.04
5.6.130.0000.09721.05
5.6.120.0100.09321.14
5.6.110.0030.06721.12
5.6.100.0000.06721.16
5.6.90.0300.07321.12
5.6.80.0130.06720.38
5.6.70.0170.08720.34
5.6.60.0070.09020.41
5.6.50.0070.08720.44
5.6.40.0030.08720.50
5.6.30.0100.08320.48
5.6.20.0130.09020.38
5.6.10.0030.09020.47
5.6.00.0170.07320.43
5.5.380.0030.05720.41
5.5.370.0100.09320.40
5.5.360.0100.08720.41
5.5.350.0030.08720.36
5.5.340.0130.09020.65
5.5.330.0070.09320.79
5.5.320.0030.09320.86
5.5.310.0100.06720.89
5.5.300.0130.05020.76
5.5.290.0130.08320.96
5.5.280.0030.06020.93
5.5.270.0170.08720.80
5.5.260.0100.09020.91
5.5.250.0070.09020.67
5.5.240.0070.10720.33
5.5.230.0200.07320.20
5.5.220.0130.07320.20
5.5.210.0130.07720.24
5.5.200.0130.08320.14
5.5.190.0100.08320.27
5.5.180.0130.08020.26
5.5.160.0100.06020.26
5.5.150.0130.07320.18
5.5.140.0130.05720.18
5.5.130.0070.05020.26
5.5.120.0070.08720.24
5.5.110.0070.05320.24
5.5.100.0100.07020.23
5.5.90.0100.06720.09
5.5.80.0070.07720.18
5.5.70.0170.07020.07
5.5.60.0170.07020.13
5.5.50.0100.08020.13
5.5.40.0100.08020.12
5.5.30.0070.09020.13
5.5.20.0030.09020.18
5.5.10.0100.08020.07
5.5.00.0030.09020.07
5.4.450.0100.08319.42
5.4.440.0100.06019.45
5.4.430.0170.08019.35
5.4.420.0130.07719.55
5.4.410.0100.08019.24
5.4.400.0100.04719.05
5.4.390.0100.08319.16
5.4.380.0100.08718.84
5.4.370.0100.08319.14
5.4.360.0100.08018.88
5.4.350.0070.07319.16
5.4.340.0000.09319.16
5.4.320.0070.09319.18
5.4.310.0170.05019.05
5.4.300.0030.06719.15
5.4.290.0130.05319.03
5.4.280.0070.06319.13
5.4.270.0100.07018.86
5.4.260.0000.08719.13
5.4.250.0030.06318.93
5.4.240.0070.08019.17
5.4.230.0070.09018.96
5.4.220.0200.07319.02
5.4.210.0100.08319.20
5.4.200.0070.05019.17
5.4.190.0000.07718.95
5.4.180.0030.05319.08
5.4.170.0100.07718.95
5.4.160.0100.06719.00
5.4.150.0070.07719.01
5.4.140.0070.08016.51
5.4.130.0100.04716.50
5.4.120.0030.08016.46
5.4.110.0170.06716.44
5.4.100.0070.07316.54
5.4.90.0030.05016.45
5.4.80.0100.07016.38
5.4.70.0070.05316.38
5.4.60.0100.07016.42
5.4.50.0100.07316.41
5.4.40.0030.08716.50
5.4.30.0000.07716.49
5.4.20.0070.06716.47
5.4.10.0030.08716.40
5.4.00.0100.07715.95
5.3.290.0030.07714.75
5.3.280.0030.08714.65
5.3.270.0170.07314.80
5.3.260.0100.08714.72
5.3.250.0030.08314.73
5.3.240.0030.09314.77
5.3.230.0130.08314.57
5.3.220.0100.07314.54
5.3.210.0030.05014.59
5.3.200.0030.07014.76
5.3.190.0170.05014.63
5.3.180.0070.05714.61
5.3.170.0130.07714.67
5.3.160.0070.07714.71
5.3.150.0030.04714.63
5.3.140.0030.05314.58
5.3.130.0030.05014.61
5.3.120.0130.07314.61
5.3.110.0070.03714.71
5.3.100.0170.06314.15
5.3.90.0100.08314.00
5.3.80.0030.08014.19
5.3.70.0070.05313.99
5.3.60.0030.10013.97
5.3.50.0030.08313.90
5.3.40.0030.07314.11
5.3.30.0070.07713.94
5.3.20.0070.07313.72
5.3.10.0070.04713.69
5.3.00.0070.08013.82
5.2.170.0100.05711.16
5.2.160.0100.05311.14
5.2.150.0030.05711.21
5.2.140.0030.06011.12
5.2.130.0100.03710.91
5.2.120.0100.04711.08
5.2.110.0030.06011.08
5.2.100.0030.06311.17
5.2.90.0070.03011.10
5.2.80.0100.06011.05
5.2.70.0030.03311.11
5.2.60.0070.05710.89
5.2.50.0030.05710.84
5.2.40.0030.05011.00
5.2.30.0030.05710.96
5.2.20.0030.06011.00
5.2.10.0100.05310.79
5.2.00.0100.05010.71
5.1.60.0070.05310.02
5.1.50.0070.0239.84
5.1.40.0070.0239.99
5.1.30.0070.05010.36
5.1.20.0100.04310.27
5.1.10.0070.04310.14
5.1.00.0070.05010.05
5.0.50.0000.0479.07
5.0.40.0000.0339.07
5.0.30.0070.0279.07
5.0.20.0070.0339.07
5.0.10.0000.0409.07
5.0.00.0070.0609.07
4.4.90.0000.0209.07
4.4.80.0070.0209.07
4.4.70.0000.0339.07
4.4.60.0100.0109.07
4.4.50.0000.0239.07
4.4.40.0030.0309.07
4.4.30.0000.0209.07
4.4.20.0030.0379.07
4.4.10.0030.0209.07
4.4.00.0030.0579.07
4.3.110.0030.0309.07
4.3.100.0070.0279.07
4.3.90.0000.0309.07
4.3.80.0030.0479.07
4.3.70.0030.0239.07
4.3.60.0000.0279.07
4.3.50.0030.0309.07
4.3.40.0000.0379.07
4.3.30.0000.0179.07
4.3.20.0000.0139.07
4.3.10.0000.0179.07
4.3.00.0000.0179.07

preferences:
33.18 ms | 400 KiB | 5 Q