3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for($i = 0; $i < pow(10, 5); $i++) { $a[$i] = array( md5(microtime(true)) ); } $sum = 0; $times['for']['before'] = microtime(true); for($j = 0; $i < count($a); $i++) { $sum += 1000; } $times['for']['after'] = microtime(true); unset($sum); $sum = 0; $times['foreach']['before'] = microtime(true); foreach($a as $k) { $sum += 1000; } $times['foreach']['after'] = microtime(true); unset($sum); $t_for = $times['for']['after'] - $times['for']['before']; $t_foreach = $times['foreach']['after'] - $times['foreach']['before']; var_dump(array($times, 'is for faster than foreach?' => $t_for < $t_foreach, $t_for, $t_foreach));

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.0540.11760.22
7.4.00.0410.11960.26
7.3.130.0360.13660.12
7.3.120.0370.11660.17
7.3.110.0370.11960.17
7.3.100.0270.09960.07
7.3.90.0420.09860.17
7.3.80.0360.10260.09
7.3.70.0200.10160.11
7.3.60.0270.09660.05
7.3.50.0200.10760.17
7.3.40.0150.11160.11
7.3.30.0280.09960.13
7.3.20.0120.10162.80
7.3.10.0190.08662.71
7.3.00.0200.08662.83
7.2.260.0300.14760.38
7.2.250.0270.14860.19
7.2.240.0170.13660.26
7.2.230.0330.12260.47
7.2.220.0260.10060.31
7.2.210.0270.11460.27
7.2.200.0310.08960.16
7.2.190.0230.10360.24
7.2.180.0270.10360.21
7.2.170.0200.10860.36
7.2.160.0300.09060.21
7.2.150.0230.08663.11
7.2.140.0100.10862.98
7.2.130.0200.10362.97
7.2.120.0330.10863.18
7.2.110.0730.12763.08
7.2.100.0100.12863.21
7.2.90.0200.10062.95
7.2.80.0230.12463.23
7.2.70.0160.11263.19
7.2.60.0270.09663.02
7.2.50.0200.08863.15
7.2.40.0200.09063.27
7.2.30.0200.10163.28
7.2.20.0100.10863.10
7.2.10.0380.12063.22
7.2.00.1240.08764.50
7.1.330.0080.12762.12
7.1.320.0130.14662.12
7.1.310.0070.13562.13
7.1.300.0100.13762.04
7.1.290.0150.13161.85
7.1.280.0200.12262.04
7.1.270.0130.13462.01
7.1.260.0170.13661.85
7.1.250.0070.14161.98
7.1.240.0200.17161.96
7.1.230.0170.15962.04
7.1.220.0290.15062.02
7.1.210.0260.11462.11
7.1.200.0170.12461.79
7.1.190.0240.12861.89
7.1.180.0130.16061.96
7.1.170.0200.12261.95
7.1.160.0260.14661.89
7.1.150.1500.12961.91
7.1.140.0420.15062.14
7.1.130.0300.13361.92
7.1.120.0170.13662.25
7.1.110.0280.12561.99
7.1.100.0140.15362.02
7.1.90.0160.14261.98
7.1.80.0140.13662.13
7.1.70.0120.11162.75
7.1.60.0240.13062.70
7.1.50.0140.12962.73
7.1.40.0140.00512.14
7.1.30.0170.13562.05
7.1.20.0080.01212.14
7.1.10.0260.12861.81
7.1.00.0310.16165.22
7.0.330.0100.13661.70
7.0.320.0230.13361.50
7.0.310.0270.12061.52
7.0.300.0130.12561.36
7.0.290.0200.11661.71
7.0.280.0070.12461.70
7.0.270.0100.14361.48
7.0.260.0230.15161.62
7.0.250.0860.12861.66
7.0.240.0270.13461.61
7.0.230.0210.12961.88
7.0.220.0110.14061.49
7.0.210.0230.13361.63
7.0.200.3410.10461.30
7.0.190.0190.13361.42
7.0.180.0230.13161.49
7.0.170.0350.12761.88
7.0.160.0100.14861.68
7.0.150.0150.00412.14
7.0.140.0100.09140.21
7.0.130.0270.16061.47
7.0.120.0140.00712.14
7.0.110.0210.13461.80
7.0.100.0240.12861.76
7.0.90.0190.15261.61
7.0.80.0190.13361.47
7.0.70.0270.12961.70
7.0.60.0210.13463.56
7.0.50.0160.15562.44
7.0.40.0110.16021.55
7.0.30.0230.14421.46
7.0.20.0330.14021.52
7.0.10.0290.14521.39
7.0.00.0100.13521.48
5.6.400.0300.19964.06
5.6.390.0430.23563.21
5.6.380.0230.20664.04
5.6.370.0360.22863.72
5.6.360.0260.18763.54
5.6.350.0270.22363.34
5.6.340.0490.22063.88
5.6.330.0130.00312.14
5.6.320.0160.22763.52
5.6.310.0360.23264.05
5.6.300.0510.21763.32
5.6.290.0460.22063.95
5.6.280.0390.21967.14
5.6.270.0450.20463.82
5.6.260.0400.21763.70
5.6.250.0430.22163.80
5.6.240.0240.23763.88
5.6.230.0350.22563.81
5.6.220.0400.20063.52
5.6.210.0330.18666.65
5.6.200.0360.21665.52
5.6.190.0240.21566.87
5.6.180.2100.21366.65
5.6.170.0400.21466.64
5.6.160.0250.21566.65
5.6.150.0180.20065.48
5.6.140.0330.19265.47
5.6.130.0400.17665.50
5.6.120.0330.22067.01
5.6.110.0350.22267.05
5.6.100.0270.19067.02
5.6.90.0230.21267.17
5.6.80.0250.23666.62
5.6.70.0380.21566.63
5.6.60.0220.21863.77
5.6.50.0440.22163.68
5.6.40.0310.24063.52
5.6.30.0270.21763.52
5.6.20.0310.21663.61
5.6.10.0420.21063.68
5.6.00.0360.23063.62
5.5.380.0500.20363.39
5.5.370.0200.22763.44
5.5.360.0390.21263.54
5.5.350.0260.20566.79
5.5.340.0240.20065.58
5.5.330.0190.20366.54
5.5.320.0320.20466.36
5.5.310.0430.21466.48
5.5.300.0210.22665.46
5.5.290.0410.21065.39
5.5.280.0260.25066.88
5.5.270.0280.19466.84
5.5.260.0320.18866.83
5.5.250.0280.21966.75
5.5.240.0320.22866.62
5.5.230.0330.21163.66
5.5.220.0270.23363.78
5.5.210.0440.22563.31
5.5.200.0350.23763.71
5.5.190.0380.20363.63
5.5.180.0570.19163.48
5.5.170.0360.20863.74
5.5.160.0360.22063.54
5.5.150.0300.24463.54
5.5.140.0260.24663.85
5.5.130.0390.19163.53
5.5.120.0430.20363.53
5.5.110.0220.21563.60
5.5.100.0430.21763.76
5.5.90.0220.21163.80
5.5.80.0290.19963.57
5.5.70.0530.18763.53
5.5.60.0240.21363.36
5.5.50.0430.21763.68
5.5.40.0400.21263.67
5.5.30.0480.18463.34
5.5.20.0620.20363.20
5.5.10.0540.21663.50
5.5.00.0170.23763.34
5.4.450.0590.31664.54
5.4.440.0720.26764.54
5.4.430.0640.25364.52
5.4.420.0650.24364.31
5.4.410.0500.27264.32
5.4.400.0500.22564.24
5.4.390.0540.26164.16
5.4.380.0330.25764.18
5.4.370.0470.25563.97
5.4.360.0510.24863.94
5.4.350.0430.25064.10
5.4.340.0610.24164.10
5.4.330.0230.21460.14
5.4.320.0280.21261.02
5.4.310.0410.19760.96
5.4.300.0410.19060.97
5.4.290.0380.20260.97
5.4.280.0350.19960.98
5.4.270.0360.23464.18
5.4.260.0230.25664.29
5.4.250.0500.24864.47
5.4.240.0330.27064.21
5.4.230.0420.31564.11
5.4.220.0360.29064.02
5.4.210.0270.27864.17
5.4.200.0370.30264.14
5.4.190.0470.31764.10
5.4.180.0450.28864.05
5.4.170.0480.28664.19
5.4.160.0350.25764.16
5.4.150.0300.28464.24
5.4.140.0420.29662.85
5.4.130.0660.30063.10
5.4.120.0450.25263.03
5.4.110.0260.26163.03
5.4.100.0300.31763.02
5.4.90.0460.27662.98
5.4.80.0420.28363.08
5.4.70.0350.33062.95
5.4.60.0350.29663.09
5.4.50.0370.28662.99
5.4.40.0450.26663.12
5.4.30.0530.25862.97
5.4.20.0280.29862.75
5.4.10.0430.26963.07
5.4.00.0430.25162.84
5.3.290.0230.23460.07
5.3.280.0300.30660.88
5.3.270.0360.32060.92
5.3.260.0330.36160.97
5.3.250.0630.29161.01
5.3.240.0360.30260.96
5.3.230.0360.29560.83
5.3.220.0480.32660.72
5.3.210.0450.31660.93
5.3.200.0440.33160.96
5.3.190.0410.29760.94
5.3.180.0220.34860.92
5.3.170.0380.30960.93
5.3.160.0270.29161.02
5.3.150.0310.28760.96
5.3.140.0370.33560.97
5.3.130.0280.34660.91
5.3.120.0240.32760.83
5.3.110.0480.31460.99
5.3.100.0280.30060.63
5.3.90.0350.25860.48
5.3.80.0370.30860.51
5.3.70.0400.31960.38
5.3.60.0330.33060.64
5.3.50.0500.36360.49
5.3.40.0450.26860.49
5.3.30.0520.35060.47
5.3.20.0370.30760.39
5.3.10.0370.42960.23
5.3.00.0280.49060.20
5.2.170.0370.35357.55
5.2.160.0430.31057.61
5.2.150.0200.33057.77
5.2.140.0270.33357.82
5.2.130.0300.35357.77
5.2.120.0300.38057.52
5.2.110.0500.40057.77
5.2.100.0430.40357.78
5.2.90.0430.38757.57
5.2.80.0500.37357.55
5.2.70.0300.31357.51
5.2.60.0370.34757.71
5.2.50.0200.39757.59
5.2.40.0530.39057.16
5.2.30.0400.43357.54
5.2.20.0770.72757.48
5.2.10.0530.63757.34
5.2.00.0430.76357.40
5.1.60.0770.79771.76
5.1.50.0370.62771.91
5.1.40.0470.63371.96
5.1.30.0500.81072.23
5.1.20.0670.73372.32
5.1.10.0500.88771.92
5.1.00.0770.84771.87
5.0.50.0400.87370.55
5.0.40.0670.82070.17
5.0.30.0570.69070.11
5.0.20.0500.65370.21
5.0.10.0530.95069.93
5.0.00.0600.76370.13
4.4.90.0500.61367.86
4.4.80.0400.56767.86
4.4.70.0430.79367.75
4.4.60.0670.64067.80
4.4.50.0630.64767.78
4.4.40.0500.58767.80
4.4.30.0430.69067.79
4.4.20.0400.58067.92
4.4.10.0670.92067.87
4.4.00.0730.77767.79
4.3.110.1070.82067.79
4.3.100.0500.70367.73
4.3.90.0300.66767.70
4.3.80.0430.61367.67
4.3.70.0470.90067.69
4.3.60.0330.58767.82
4.3.50.0370.62367.84
4.3.40.0330.68367.89
4.3.30.0470.62066.62
4.3.20.0800.87066.63
4.3.10.0330.83766.54
4.3.00.0770.69066.46

preferences:
38.88 ms | 401 KiB | 5 Q