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('for' => $t_for, 'foreach' => $t_foreach, 'is for faster than 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.2.00.0030.07365.52
7.1.70.0070.10163.33
7.1.60.0170.13963.34
7.1.50.0340.10863.37
7.1.00.0000.10368.62
7.0.200.7760.09360.89
7.0.140.0130.17368.22
7.0.120.0070.18768.29
7.0.60.0070.12365.34
7.0.50.0300.15363.10
7.0.40.0130.17323.77
7.0.30.0330.13023.73
7.0.20.0430.11323.52
7.0.10.0170.17323.74
7.0.00.0200.16023.69
5.6.280.0230.24070.08
5.6.210.0400.23769.80
5.6.200.0130.17367.43
5.6.190.0100.20769.53
5.6.180.0570.19369.57
5.6.170.0600.21069.70
5.6.160.0070.25369.65
5.6.150.0230.17767.34
5.6.140.0230.24067.40
5.6.130.0070.17767.42
5.6.120.0270.23370.37
5.6.110.0300.21770.25
5.6.100.0230.23770.26
5.6.90.0270.22770.36
5.6.80.0130.19769.65
5.5.350.0130.22769.57
5.5.340.0170.24067.14
5.5.330.0030.25069.46
5.5.320.1470.20369.47
5.5.310.0370.19069.42
5.5.300.0330.23067.14
5.5.290.0230.22067.15
5.5.280.0330.20070.23
5.5.270.0330.23369.92
5.5.260.0200.22070.14
5.5.250.0170.24769.73
5.5.240.0230.23069.43
5.4.450.0800.16368.30
5.4.440.0700.23368.56
5.4.430.0570.17368.44
5.4.420.0830.21368.41
5.4.410.0870.18068.42
5.4.400.0630.20768.42
5.4.390.0700.22768.21
5.4.380.0730.21767.97
5.4.370.1470.17768.00
5.4.360.0770.19767.97
5.4.350.1000.16768.23
5.4.340.1000.18068.21
5.4.320.0600.20768.12
5.4.310.0430.21768.25
5.4.300.0700.24367.97
5.4.290.0900.23068.23
5.4.280.0430.28368.08
5.4.270.0800.16368.26
5.4.260.0930.21068.00
5.4.250.0800.18368.44
5.4.240.0900.16768.23
5.4.230.0830.18768.40
5.4.220.0700.23068.23
5.4.210.0900.18068.20
5.4.200.0570.17068.32
5.4.190.0730.15368.32
5.4.180.0700.19068.41
5.4.170.0770.19368.40
5.4.160.1000.18068.24
5.4.150.1070.19368.41
5.4.140.0430.18365.68
5.4.130.0800.16765.43
5.4.120.0300.20765.57
5.4.110.0600.19765.23
5.4.100.0800.23765.66
5.4.90.0600.23365.31
5.4.80.0930.20365.59
5.4.70.0700.20065.56
5.4.60.0300.19365.70
5.4.50.0900.17365.65
5.4.40.0770.19765.70
5.4.30.1030.17065.66
5.4.20.0830.17065.50
5.4.10.0570.19065.59
5.4.00.0600.18764.96
5.3.290.0970.23062.86
5.3.280.0670.20762.86
5.3.270.0400.18062.88
5.3.260.0800.20763.03
5.3.250.0570.25062.80
5.3.240.0800.27362.89
5.3.230.0830.18062.79
5.3.220.1070.21062.77
5.3.210.0430.19763.38
5.3.200.0630.20762.85
5.3.190.0400.20062.74
5.3.180.0770.22362.71
5.3.170.0770.23762.84
5.3.160.0900.23062.83
5.3.150.0630.20762.77
5.3.140.0700.21062.71
5.3.130.0500.18762.75
5.3.120.1000.20062.84
5.3.110.0670.21062.83
5.3.100.0770.20362.34
5.3.90.0800.19062.28
5.3.80.0630.21362.14
5.3.70.0730.16762.16
5.3.60.1000.22362.13
5.3.50.1170.21362.17
5.3.40.0530.19362.17
5.3.30.0700.16762.11
5.3.20.2100.18761.82
5.3.10.0400.32061.88
5.3.00.0600.34061.85
5.2.170.0600.18057.50
5.2.160.0630.14357.49
5.2.150.0600.20057.68
5.2.140.0900.18057.77
5.2.130.0270.18357.57
5.2.120.0870.19057.51
5.2.110.0530.20757.50
5.2.100.0600.20057.58
5.2.90.0800.22757.71
5.2.80.0630.15357.61
5.2.70.0630.17357.47
5.2.60.0600.19057.38
5.2.50.0330.17757.29
5.2.40.0670.22057.25
5.2.30.0470.19057.42
5.2.20.0100.44757.55
5.2.10.0530.34057.42
5.2.00.0330.33357.12
5.1.60.0430.38771.80
5.1.50.0330.42371.79
5.1.40.0730.39771.62
5.1.30.0370.38072.09
5.1.20.0630.35371.98
5.1.10.0470.39071.67
5.1.00.0770.35071.69
5.0.50.0530.52370.18
5.0.40.0430.49370.12
5.0.30.0270.45769.80
5.0.20.0470.45369.88
5.0.10.0370.45769.97
5.0.00.0630.49069.88
4.4.90.0330.33367.66
4.4.80.0570.39767.65
4.4.70.0430.39767.70
4.4.60.0370.29067.73
4.4.50.0200.27767.65
4.4.40.0330.40067.62
4.4.30.0130.31767.62
4.4.20.0570.27367.79
4.4.10.0430.41067.72
4.4.00.0430.39067.68
4.3.110.0370.39067.58
4.3.100.0300.44367.64
4.3.90.0370.36067.59
4.3.80.0530.45767.52
4.3.70.0400.37767.63
4.3.60.0570.35767.56
4.3.50.0200.30767.73
4.3.40.0330.37767.82
4.3.30.0300.38066.58
4.3.20.0930.35366.56
4.3.10.0270.35366.44
4.3.00.0230.35066.51

preferences:
42.78 ms | 401 KiB | 5 Q