3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for($i = 0; $i < pow(10, 5); $i++) { $a[$i] = array( md5($i.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( 'for' => sprintf('%f', $t_for), 'foreach' => sprintf('%f', $t_foreach), 'is \'for\' faster than \'foreach\'?' => $t_for < $t_foreach, 'how much faster?' => "".(1 - ($t_for / $t_foreach)) * 100).'%' );

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.3.10.0570.10862.80
7.3.00.0650.09562.71
7.2.130.0580.11263.02
7.2.120.0710.09862.86
7.2.110.0790.10063.07
7.2.100.0560.10762.73
7.2.90.0960.11362.88
7.2.80.0800.11562.89
7.2.70.0840.10762.69
7.2.60.1020.10763.02
7.2.50.1000.11962.84
7.2.40.1240.10463.06
7.2.30.1050.10763.11
7.2.20.1060.11863.04
7.2.10.1090.12562.67
7.2.00.0890.10863.76
7.1.250.0550.15162.01
7.1.240.0860.13962.08
7.1.230.0460.15261.98
7.1.220.0490.13861.91
7.1.210.0370.16761.55
7.1.200.0370.16061.41
7.1.190.0670.16461.51
7.1.180.0470.14861.80
7.1.170.0680.16161.86
7.1.160.0810.14661.84
7.1.150.0800.13762.01
7.1.140.0650.16161.92
7.1.130.0830.16261.86
7.1.120.0380.16762.08
7.1.110.0650.15461.89
7.1.100.0710.13561.96
7.1.90.0820.14661.96
7.1.80.0660.15762.05
7.1.70.0490.11562.69
7.1.60.0420.14162.89
7.1.50.0420.11962.76
7.1.40.0640.14461.94
7.1.30.0600.15061.93
7.1.20.0480.16961.76
7.1.10.0750.15261.77
7.1.00.0230.16765.11
7.0.330.0460.15561.67
7.0.320.0630.12561.48
7.0.310.0740.16161.48
7.0.300.0520.15361.38
7.0.290.0660.15261.21
7.0.280.0510.13961.18
7.0.270.0690.14761.68
7.0.260.0770.14561.51
7.0.250.0460.16261.73
7.0.240.0820.16161.66
7.0.230.0720.15861.69
7.0.220.0710.14461.59
7.0.210.0740.15261.62
7.0.200.6790.11661.29
7.0.190.0700.14561.77
7.0.180.0830.15361.74
7.0.170.0580.14461.70
7.0.160.0640.14261.52
7.0.150.0560.14661.66
7.0.140.0380.16265.06
7.0.130.0760.14561.87
7.0.120.0830.14761.57
7.0.110.0700.14461.70
7.0.100.0510.15861.86
7.0.90.0630.14061.57
7.0.80.0780.15361.90
7.0.70.0710.17061.75
7.0.60.0360.17863.45
7.0.50.0490.13262.38
7.0.40.0230.14121.49
7.0.30.0200.13921.46
7.0.20.0180.14621.44
7.0.10.0150.15321.51
7.0.00.0150.17121.59
5.6.380.0300.22463.65
5.6.370.0390.23063.22
5.6.360.0370.21863.39
5.6.350.0410.22163.34
5.6.340.0100.26363.85
5.6.330.0390.22963.98
5.6.320.0270.24063.99
5.6.310.0340.24663.79
5.6.300.0360.22163.70
5.6.290.0200.24363.88
5.6.280.0360.23167.11
5.6.270.0390.24463.77
5.6.260.0270.23764.01
5.6.250.0480.20663.84
5.6.240.0400.25263.62
5.6.230.0530.22663.73
5.6.220.0380.24463.51
5.6.210.0330.22766.95
5.6.200.0270.22365.41
5.6.190.0270.25966.53
5.6.180.0540.22466.68
5.6.170.0430.22466.73
5.6.160.0320.22466.55
5.6.150.0320.21365.63
5.6.140.0300.24865.46
5.6.130.0260.22165.75
5.6.120.0380.22267.00
5.6.110.0350.25567.15
5.6.100.0310.23067.00
5.6.90.0250.23767.18
5.6.80.0300.20866.51
5.6.70.0340.22663.71
5.6.60.0320.22763.55
5.6.50.0490.21463.86
5.6.40.0460.23463.82
5.6.30.0310.24263.69
5.6.20.0390.22363.56
5.6.10.0260.24963.63
5.6.00.0340.25464.02
5.5.380.0200.25360.79
5.5.370.0300.23160.34
5.5.360.0560.20260.61
5.5.350.2340.20965.11
5.5.340.0320.21363.77
5.5.330.0250.21464.89
5.5.320.0420.22864.84
5.5.310.0370.21564.76
5.5.300.0320.20963.89
5.5.290.0470.22863.70
5.5.280.0240.22065.27
5.5.270.0170.22165.33
5.5.260.0330.23965.26
5.5.250.0330.24565.22
5.5.240.0250.23964.98
5.5.230.0200.24360.37
5.5.220.0200.23760.30
5.5.210.0390.22360.33
5.5.200.0260.23560.23
5.5.190.0200.25260.48
5.5.180.0260.24260.28
5.5.170.0230.25260.64
5.5.160.0330.22260.38
5.5.150.0270.24060.16
5.5.140.0400.22660.55
5.5.130.0330.22760.32
5.5.120.0380.22460.57
5.5.110.0460.21060.36
5.5.100.0270.22960.27
5.5.90.0200.24460.24
5.5.80.0200.25160.42
5.5.70.0260.22860.48
5.5.60.0400.22360.31
5.5.50.0400.29360.48
5.5.40.0330.27360.34
5.5.30.0290.23160.05
5.5.20.0240.24060.22
5.5.10.0340.26960.14
5.5.00.0520.22660.22
5.4.450.0400.26064.37
5.4.440.0420.19564.38
5.4.430.0570.21064.46
5.4.420.0760.25664.51
5.4.410.0620.23064.49
5.4.400.0300.29064.22
5.4.390.0350.30964.10
5.4.380.0350.27764.18
5.4.370.0500.27364.13
5.4.360.0580.26864.15
5.4.350.0570.26464.04
5.4.340.0530.26464.08
5.4.330.0400.24260.40
5.4.320.0310.21860.98
5.4.310.0310.22761.10
5.4.300.0400.21360.97
5.4.290.0250.22860.99
5.4.280.0340.23061.00
5.4.270.0480.35764.29
5.4.260.0480.32964.11
5.4.250.0430.33664.29
5.4.240.0390.33964.19
5.4.230.0620.32264.17
5.4.220.0450.33064.30
5.4.210.0570.30264.24
5.4.200.0430.28564.26
5.4.190.0350.35064.25
5.4.180.0420.33164.05
5.4.170.0480.33564.08
5.4.160.0640.33464.26
5.4.150.0430.29164.14
5.4.140.0420.33263.03
5.4.130.0500.35763.01
5.4.120.0370.34963.10
5.4.110.0480.31263.13
5.4.100.0580.34663.16
5.4.90.0530.32062.84
5.4.80.0490.34662.92
5.4.70.0380.29662.99
5.4.60.0500.33362.91
5.4.50.0370.27462.92
5.4.40.0500.28463.11
5.4.30.0390.31262.99
5.4.20.0370.27562.84
5.4.10.0370.28362.98
5.4.00.0370.29762.69
5.3.290.0400.24759.99
5.3.280.0520.28960.95
5.3.270.0250.38860.90
5.3.260.0350.37460.95
5.3.250.0580.35560.91
5.3.240.0400.40660.88
5.3.230.0470.36760.82
5.3.220.0400.38560.85
5.3.210.0530.38560.90
5.3.200.0430.31560.89
5.3.190.0450.38860.89
5.3.180.0420.36260.80
5.3.170.0430.35560.95
5.3.160.0540.39160.91
5.3.150.0470.37060.95
5.3.140.0340.34360.87
5.3.130.0430.32560.96
5.3.120.0320.33260.86
5.3.110.0400.32760.78
5.3.100.0370.34060.68
5.3.90.0310.30260.69
5.3.80.0550.29760.54
5.3.70.0310.30260.46
5.3.60.0440.33460.56
5.3.50.0310.33060.56
5.3.40.0450.34560.53
5.3.30.0320.35960.58
5.3.20.0400.32060.34
5.3.10.0500.53560.28
5.3.00.0500.59260.20
5.2.170.0300.28856.79
5.2.160.0350.28256.79
5.2.150.0260.32256.71
5.2.140.0170.34856.84
5.2.130.0400.29256.61
5.2.120.0350.33256.77
5.2.110.0450.35156.74
5.2.100.0240.34956.70
5.2.90.0380.29856.63
5.2.80.0480.32256.69
5.2.70.0500.36656.65
5.2.60.0400.31556.68
5.2.50.0370.34856.68
5.2.40.0430.37456.67
5.2.30.0380.33356.53
5.2.20.0410.50456.52
5.2.10.0400.66056.53
5.2.00.0250.72756.35
5.1.60.0380.65470.90
5.1.50.0470.67271.07
5.1.40.0370.54871.11
5.1.30.0470.64471.33
5.1.20.0380.65571.27
5.1.10.0530.65571.15
5.1.00.0370.62170.94
5.0.50.0520.68369.86
5.0.40.0410.73169.76
5.0.30.0470.84769.60
5.0.20.0680.83169.51
5.0.10.0380.80369.52
5.0.00.0400.63169.49
4.4.90.0380.62767.40
4.4.80.0420.61367.41
4.4.70.0450.64867.42
4.4.60.0370.54667.38
4.4.50.0370.63567.37
4.4.40.0400.59567.37
4.4.30.0450.63467.42
4.4.20.0350.64867.47
4.4.10.0470.57367.48
4.4.00.0370.69567.35
4.3.110.0380.57367.24
4.3.100.0500.71467.32
4.3.90.0380.60067.29
4.3.80.0380.59867.21
4.3.70.0350.60067.21
4.3.60.0400.68767.20
4.3.50.0430.72367.49
4.3.40.0380.66167.49
4.3.30.0400.68866.62
4.3.20.0700.59866.50
4.3.10.0450.63266.59
4.3.00.0500.65066.52

preferences:
45.18 ms | 400 KiB | 5 Q