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' => $t_for, 'foreach' => $t_foreach, 'is for faster than foreach?' => $t_for < $t_foreach, 'how much faster?' => (1 - ($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.0530.13260.39
7.4.00.0470.13360.11
7.3.130.0270.10760.09
7.3.120.0330.14560.30
7.3.110.0230.12560.29
7.3.100.0300.11360.16
7.3.90.0300.11760.27
7.3.80.0260.10860.23
7.3.70.0360.09660.22
7.3.60.0300.13360.25
7.3.50.0330.12560.24
7.3.40.0300.09659.98
7.3.30.0230.11660.23
7.3.20.0130.14662.84
7.3.10.0300.10363.09
7.3.00.0100.09162.68
7.2.260.0370.13460.55
7.2.250.0390.15260.50
7.2.240.0260.13260.34
7.2.230.0200.14460.32
7.2.220.0270.11660.62
7.2.210.0300.12260.49
7.2.200.0340.13560.43
7.2.190.0320.11360.06
7.2.180.0230.10560.34
7.2.170.0300.09960.44
7.2.160.0230.11060.45
7.2.150.0170.15663.18
7.2.140.0230.09363.11
7.2.130.0160.10863.00
7.2.120.0200.12063.18
7.2.110.0200.11263.16
7.2.100.0260.09863.35
7.2.90.0070.13162.95
7.2.80.0520.10162.95
7.2.70.1240.12063.13
7.2.60.0070.10763.16
7.2.50.0100.10562.82
7.2.40.0310.12063.04
7.2.30.0100.11962.88
7.2.20.0180.11463.07
7.2.10.0200.11563.02
7.2.00.0170.09864.43
7.1.330.0070.17262.02
7.1.320.0100.18061.93
7.1.310.0100.14361.93
7.1.300.0030.17562.07
7.1.290.0030.14262.06
7.1.280.0200.12861.95
7.1.270.0070.16862.20
7.1.260.0070.14562.00
7.1.250.0330.14362.00
7.1.240.0170.16161.88
7.1.230.0240.15862.11
7.1.220.0230.13062.00
7.1.210.0160.13361.80
7.1.200.2340.16561.74
7.1.190.0470.15662.08
7.1.180.0250.13862.20
7.1.170.0200.13561.89
7.1.160.0170.14461.94
7.1.150.0170.14062.13
7.1.140.0100.14862.13
7.1.130.0240.15762.03
7.1.120.0170.15862.03
7.1.110.0320.14262.18
7.1.100.0250.13962.10
7.1.90.0220.15061.68
7.1.80.0320.14962.15
7.1.70.0230.11662.54
7.1.60.0200.14462.79
7.1.50.0420.11562.71
7.1.40.0370.13561.96
7.1.30.0180.15262.21
7.1.20.0260.14261.91
7.1.10.0170.15162.11
7.1.00.0120.13465.33
7.0.330.0100.17961.63
7.0.320.0100.14161.68
7.0.310.0030.14561.51
7.0.300.0100.16461.39
7.0.290.0260.14061.38
7.0.280.0210.15561.82
7.0.270.0310.13761.68
7.0.260.0400.14261.75
7.0.250.0100.16461.69
7.0.240.0240.14861.72
7.0.230.0140.16561.69
7.0.220.0170.16461.73
7.0.210.0350.15061.48
7.0.200.1880.11361.10
7.0.190.0170.15561.50
7.0.180.0280.16161.72
7.0.170.0350.14361.80
7.0.160.0370.13461.45
7.0.150.0170.14761.78
7.0.140.0230.15564.96
7.0.130.0140.15161.69
7.0.120.0170.14364.95
7.0.110.0410.13961.73
7.0.100.0280.14361.70
7.0.90.0330.15361.82
7.0.80.0220.14261.75
7.0.70.0250.13661.65
7.0.60.0180.16163.46
7.0.50.0150.14362.46
7.0.40.0210.15720.37
7.0.30.0230.14920.28
7.0.20.0150.14220.26
7.0.10.0180.15720.43
7.0.00.0200.15320.19
5.6.400.0230.21463.98
5.6.390.0300.25563.39
5.6.380.0270.23463.77
5.6.370.0190.22563.88
5.6.360.0300.22963.85
5.6.350.0230.23063.59
5.6.340.0390.23963.99
5.6.330.0560.21463.39
5.6.320.0420.23663.48
5.6.310.0430.24363.62
5.6.300.0300.26063.69
5.6.290.0370.22564.06
5.6.280.0150.25666.97
5.6.270.0330.22663.68
5.6.260.0400.22963.47
5.6.250.0300.22064.07
5.6.240.0410.24063.89
5.6.230.0230.23263.64
5.6.220.0540.20864.05
5.6.210.0330.25266.80
5.6.200.0410.23765.43
5.6.190.0260.23865.50
5.6.180.0230.23365.47
5.6.170.0160.21565.49
5.6.160.0230.23665.59
5.6.150.0330.22665.66
5.6.140.0270.23965.63
5.6.130.0300.22465.48
5.6.120.0350.20565.64
5.6.110.0260.23365.64
5.6.100.0380.21065.52
5.6.90.0250.20765.48
5.6.80.0320.20465.13
5.6.70.0250.23465.09
5.6.60.0310.23365.27
5.6.50.0320.22965.32
5.6.40.0330.23165.19
5.6.30.0250.24365.22
5.6.20.0330.22565.28
5.6.10.0350.21065.26
5.6.00.0280.23565.23
5.5.380.0530.21163.81
5.5.370.0170.27163.66
5.5.360.0340.22163.78
5.5.350.0470.20766.73
5.5.340.0340.24065.38
5.5.330.0500.21565.56
5.5.320.0230.23765.48
5.5.310.0440.22665.40
5.5.300.0250.24165.55
5.5.290.0160.23565.54
5.5.280.0170.25365.32
5.5.270.0370.22865.38
5.5.260.0190.21965.43
5.5.250.0250.22665.36
5.5.240.0200.22965.01
5.5.230.0200.22065.00
5.5.220.0280.23065.13
5.5.210.0270.20965.13
5.5.200.0350.24065.10
5.5.190.0380.23265.21
5.5.180.0200.25765.00
5.5.170.0390.23263.50
5.5.160.0300.22765.11
5.5.150.0230.23765.15
5.5.140.0200.24365.20
5.5.130.0340.20364.99
5.5.120.0170.23165.09
5.5.110.0320.24065.05
5.5.100.0230.24365.07
5.5.90.0250.21664.97
5.5.80.0310.23565.02
5.5.70.0180.22265.16
5.5.60.0280.21065.11
5.5.50.0300.20464.99
5.5.40.0200.20665.13
5.5.30.0230.21965.07
5.5.20.0250.21764.86
5.5.10.0230.21265.11
5.5.00.0280.22565.02
5.4.450.0300.22264.31
5.4.440.0250.23464.50
5.4.430.0120.22164.53
5.4.420.0250.21564.39
5.4.410.0300.21564.39
5.4.400.0250.25064.34
5.4.390.0170.21364.26
5.4.380.0270.23964.21
5.4.370.0320.22364.20
5.4.360.0270.24764.19
5.4.350.0270.24064.30
5.4.340.0310.22864.26
5.4.330.0270.22960.37
5.4.320.0270.20364.18
5.4.310.0360.20164.24
5.4.300.0280.23064.14
5.4.290.0300.20564.13
5.4.280.0240.21664.31
5.4.270.0170.23964.31
5.4.260.0320.22364.32
5.4.250.0310.21564.28
5.4.240.0320.22764.22
5.4.230.0330.21064.35
5.4.220.0250.21164.28
5.4.210.0300.19664.17
5.4.200.0220.20064.32
5.4.190.0200.19964.18
5.4.180.0130.21464.21
5.4.170.0250.22964.25
5.4.160.0230.20464.33
5.4.150.0230.23364.25
5.4.140.0370.19963.12
5.4.130.0180.21962.96
5.4.120.0400.23062.82
5.4.110.0260.22763.03
5.4.100.0280.24962.95
5.4.90.0380.24762.92
5.4.80.0280.23963.02
5.4.70.0320.23062.77
5.4.60.0600.19162.85
5.4.50.0210.24162.97
5.4.40.0260.21762.98
5.4.30.0350.20262.86
5.4.20.0170.23762.94
5.4.10.0270.23762.87
5.4.00.0320.23862.70
5.3.290.0220.21960.87
5.3.280.0230.21660.92
5.3.270.0220.22460.82
5.3.260.0230.25860.87
5.3.250.0230.23960.95
5.3.240.0120.23860.85
5.3.230.0230.25660.81
5.3.220.0360.25560.68
5.3.210.0220.24560.81
5.3.200.0250.27060.83
5.3.190.0230.26160.90
5.3.180.0250.24760.84
5.3.170.0260.24060.90
5.3.160.0200.28260.93
5.3.150.0340.25860.91
5.3.140.0310.25760.83
5.3.130.0300.24660.83
5.3.120.0130.25460.73
5.3.110.0370.23860.82
5.3.100.0330.24760.56
5.3.90.0150.27560.57
5.3.80.0400.25560.53
5.3.70.0250.27160.45
5.3.60.0220.27260.51
5.3.50.0380.25260.35
5.3.40.0350.23660.46
5.3.30.0180.28460.46
5.3.20.0180.25960.28
5.3.10.0270.38460.08
5.3.00.0210.36860.16
5.2.170.0200.21357.75
5.2.160.0130.22357.61
5.2.150.0230.19357.60
5.2.140.0270.23057.55
5.2.130.0070.24357.50
5.2.120.0270.23357.55
5.2.110.0330.19357.55
5.2.100.0070.24757.47
5.2.90.0270.24757.54
5.2.80.0270.24357.46
5.2.70.0170.19057.56
5.2.60.0200.16757.42
5.2.50.0070.18357.32
5.2.40.0170.18057.34
5.2.30.0170.23757.30
5.2.20.0870.36057.36
5.2.10.0230.38757.18
5.2.00.0270.39357.18
5.1.60.0100.42371.72
5.1.50.0130.40771.66
5.1.40.0130.35371.65
5.1.30.0200.42372.00
5.1.20.0370.40072.02
5.1.10.0270.43071.84
5.1.00.0230.42371.82
5.0.50.0400.52770.30
5.0.40.0100.47770.14
5.0.30.0230.50069.77
5.0.20.0230.43069.87
5.0.10.0100.44369.84
5.0.00.0030.47070.00
4.4.90.0030.37067.68
4.4.80.0100.38767.59
4.4.70.0200.36767.72
4.4.60.1700.37767.70
4.4.50.0200.38067.70
4.4.40.0900.36067.70
4.4.30.0230.32067.64
4.4.20.1070.34767.74
4.4.10.0230.37767.75
4.4.00.0170.39067.73
4.3.110.0300.37067.66
4.3.100.0200.37367.56
4.3.90.0230.38367.52
4.3.80.0130.42067.64
4.3.70.0300.35367.58
4.3.60.0200.41067.54
4.3.50.0130.43067.82
4.3.40.0200.34767.77
4.3.30.0170.38066.58
4.3.20.0130.32766.61
4.3.10.0170.36766.50
4.3.00.0270.41066.40

preferences:
32.83 ms | 401 KiB | 5 Q