3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 100; $array = range(0, $iter); $function = function($val, $key = null) {}; $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); } 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.0070.01119.53
7.1.70.0030.00617.20
7.1.60.0100.01719.17
7.1.50.0160.00616.93
7.1.00.0000.05722.28
7.0.200.0000.00916.64
7.0.140.0130.06722.00
7.0.60.0070.04019.91
7.0.50.0030.05017.78
7.0.40.0200.04319.96
7.0.30.0230.04320.30
7.0.20.0200.05720.22
7.0.10.0030.07320.25
7.0.00.0070.09020.15
5.6.280.0070.08020.93
5.6.210.0030.09720.56
5.6.200.0030.04718.20
5.6.190.0030.06020.52
5.6.180.0270.09020.64
5.6.170.0200.04720.51
5.6.160.0100.06320.50
5.6.150.0070.07018.21
5.6.140.0070.09018.18
5.6.130.0030.05718.18
5.6.120.0000.05020.93
5.6.110.0130.06021.01
5.6.100.0170.08721.01
5.6.90.0100.08721.16
5.6.80.0070.05720.42
5.5.350.3730.04020.37
5.5.340.0070.08718.02
5.5.330.0070.05020.30
5.5.320.0270.08020.24
5.5.310.0300.08020.35
5.5.300.0100.08318.02
5.5.290.0130.08718.00
5.5.280.0100.06720.68
5.5.270.0100.07320.83
5.5.260.0100.04020.84
5.5.250.0170.08320.74
5.5.240.0000.04320.30
5.4.450.3230.04319.57
5.4.440.3070.04319.47
5.4.430.3200.04319.46
5.4.420.3400.04319.54
5.4.410.3270.05319.32
5.4.400.3870.04719.09
5.4.390.2870.04719.12
5.4.380.2830.04319.22
5.4.370.0030.08319.14
5.4.360.0100.08019.05
5.4.350.0100.06719.24
5.4.340.2130.05719.20
5.4.320.3000.04319.10
5.4.310.3130.04319.05
5.4.300.3100.04718.84
5.4.290.3570.03019.23
5.4.280.3130.03319.16
5.4.270.3300.03718.84
5.4.260.3730.04719.16
5.4.250.3630.03719.07
5.4.240.3470.03719.19
5.4.230.3570.04018.83
5.4.220.3800.04319.23
5.4.210.3900.03719.24
5.4.200.3670.05019.14
5.4.190.3300.03319.23
5.4.180.3300.04319.13
5.4.170.3470.04318.86
5.4.160.3370.04019.00
5.4.150.3200.04719.19
5.4.140.3030.04016.36
5.4.130.2630.04016.38
5.4.120.3200.04016.34
5.4.110.0200.07716.46
5.4.100.0030.08016.40
5.4.90.0070.09016.33
5.4.80.1770.06016.49
5.4.70.3930.03716.54
5.4.60.3470.04016.48
5.4.50.3030.03716.49
5.4.40.3330.04016.58
5.4.30.3070.04316.47
5.4.20.3230.04316.36
5.4.10.3270.04016.42
5.4.00.3000.03716.01
5.3.290.2700.03714.69
5.3.280.3130.04714.54
5.3.270.3000.03714.65
5.3.260.3470.04314.62
5.3.250.3630.03714.64
5.3.240.4030.03014.55
5.3.230.3930.04014.53
5.3.220.3900.04314.72
5.3.210.3900.04014.57
5.3.200.3800.04314.72
5.3.190.3700.04014.68
5.3.180.3600.03014.74
5.3.170.3730.04314.75
5.3.160.3200.04014.60
5.3.150.3770.04014.65
5.3.140.3730.04714.56
5.3.130.3470.04014.59
5.3.120.3600.04014.56
5.3.110.3600.04014.67
5.3.100.3800.04014.09
5.3.90.3800.04313.96
5.3.80.3830.04013.95
5.3.70.4000.04714.08
5.3.60.3200.04014.01
5.3.50.3330.03713.89
5.3.40.3230.03714.05
5.3.30.3370.05013.86
5.3.20.3230.03713.87
5.3.10.2900.04013.74
5.3.00.3200.03713.75
5.2.170.2970.03312.24
5.2.160.2670.03012.24
5.2.150.2730.03012.24
5.2.140.2530.02712.24
5.2.130.2470.02712.24
5.2.120.2800.03012.24
5.2.110.2670.03712.24
5.2.100.2470.02712.24
5.2.90.2430.02712.24
5.2.80.2730.03012.24
5.2.70.2570.02712.24
5.2.60.2500.03012.24
5.2.50.2700.03312.24
5.2.40.1930.03012.24
5.2.30.2230.03012.24
5.2.20.2100.03312.24
5.2.10.2130.03312.24
5.2.00.2230.02012.24
5.1.60.2330.02312.24
5.1.50.2130.02712.24
5.1.40.2200.02312.24
5.1.30.2230.02312.24
5.1.20.2200.03012.24
5.1.10.2270.03012.24
5.1.00.2070.03012.24
5.0.50.0930.02312.24
5.0.40.1170.02012.24
5.0.30.1230.03012.24
5.0.20.1130.01712.24
5.0.10.1030.02312.24
5.0.00.1000.03012.24
4.4.90.1270.02012.24
4.4.80.1600.00712.24
4.4.70.1500.01712.24
4.4.60.1230.01712.24
4.4.50.1170.01312.24
4.4.40.1370.02712.24
4.4.30.1600.01712.24
4.4.20.1430.01712.24
4.4.10.1130.01712.24
4.4.00.1330.02712.24
4.3.110.1230.02012.24
4.3.100.1230.02012.24
4.3.90.1200.01712.24
4.3.80.1300.02312.24
4.3.70.0970.01312.24
4.3.60.1230.02012.24
4.3.50.0970.01312.24
4.3.40.1200.03012.24
4.3.30.0570.02312.24
4.3.20.0630.02012.24
4.3.10.0530.01312.24
4.3.00.0700.02012.24

preferences:
34.22 ms | 400 KiB | 5 Q