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));

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.0460.07565.67
7.1.70.0070.09463.21
7.1.60.0070.13463.66
7.1.50.0390.13563.52
7.1.00.0070.10368.45
7.0.200.1880.02328.49
7.0.140.0000.18068.44
7.0.120.0030.20068.25
7.0.60.0370.17065.22
7.0.50.0170.18763.09
7.0.40.0200.18021.34
7.0.30.0270.13021.15
7.0.20.0170.16721.39
7.0.10.0200.17321.41
7.0.00.0130.14021.34
5.6.280.0200.26070.29
5.6.210.0230.25769.77
5.6.200.0200.24767.35
5.6.190.0230.24367.32
5.6.180.0200.19367.42
5.6.170.0070.24367.44
5.6.160.0230.20067.43
5.6.150.0130.24367.29
5.6.140.0270.24367.29
5.6.130.0200.22767.32
5.6.120.0300.21067.43
5.6.110.0200.24367.30
5.6.100.0230.24367.33
5.6.90.0200.24367.41
5.6.80.0170.24066.81
5.6.70.0200.22366.57
5.6.60.0070.22066.81
5.6.50.0170.20766.79
5.6.40.0300.16366.65
5.6.30.0370.23766.74
5.6.20.0130.18366.70
5.6.10.0130.18366.79
5.6.00.0370.15366.67
5.5.350.0370.23069.77
5.5.340.0130.25767.00
5.5.330.0300.21067.15
5.5.320.0270.24067.23
5.5.310.0330.23367.23
5.5.300.0370.23367.19
5.5.290.0230.18767.09
5.5.280.0170.25067.18
5.5.270.0230.25067.17
5.5.260.0200.25767.20
5.5.250.0330.23366.96
5.5.240.0230.24366.59
5.5.230.0200.25766.57
5.5.220.0170.20766.52
5.5.210.0170.20366.54
5.5.200.0200.18066.58
5.5.190.0200.19366.52
5.5.180.0200.18066.51
5.5.160.0370.20766.59
5.5.150.0130.19366.47
5.5.140.0370.15766.59
5.5.130.0100.21366.58
5.5.120.0270.17366.32
5.5.110.0330.18766.49
5.5.100.0130.18066.51
5.5.90.0270.17766.40
5.5.80.0170.18366.50
5.5.70.0100.27066.39
5.5.60.0330.24366.34
5.5.50.0200.20366.44
5.5.40.0130.24366.41
5.5.30.0170.22066.44
5.5.20.0230.24066.40
5.5.10.0170.25766.34
5.5.00.0130.18766.43
5.4.450.0170.23368.47
5.4.440.0230.25368.45
5.4.430.0170.21368.53
5.4.420.0400.21768.50
5.4.410.0230.23368.39
5.4.400.0100.23768.20
5.4.390.0230.21768.11
5.4.380.0470.21368.30
5.4.370.0200.17768.09
5.4.360.0130.18768.23
5.4.350.0200.19068.31
5.4.340.0230.19068.20
5.4.320.0170.17768.12
5.4.310.0270.16768.03
5.4.300.0170.17368.23
5.4.290.0200.17368.18
5.4.280.0270.18068.22
5.4.270.0200.17768.20
5.4.260.0200.18068.14
5.4.250.0100.18068.10
5.4.240.0030.19368.11
5.4.230.0270.22368.03
5.4.220.0200.24368.27
5.4.210.0230.18368.10
5.4.200.0170.23068.30
5.4.190.0270.21768.09
5.4.180.0300.23068.02
5.4.170.0070.26068.26
5.4.160.0330.16768.14
5.4.150.0270.17068.00
5.4.140.0270.21065.50
5.4.130.0230.21765.52
5.4.120.0270.24765.50
5.4.110.0270.17065.64
5.4.100.0270.22065.49
5.4.90.0200.24765.48
5.4.80.0230.25065.52
5.4.70.0170.20065.50
5.4.60.0330.24365.45
5.4.50.0370.24065.48
5.4.40.0130.24365.39
5.4.30.0230.19765.46
5.4.20.0300.23365.57
5.4.10.0300.21065.57
5.4.00.0130.24764.96
5.3.290.0100.21362.90
5.3.280.0170.25362.89
5.3.270.0200.26362.93
5.3.260.0200.19062.95
5.3.250.0200.25762.85
5.3.240.0300.25062.89
5.3.230.0130.26762.91
5.3.220.0170.25362.86
5.3.210.0170.22362.89
5.3.200.0300.26362.74
5.3.190.0200.19762.69
5.3.180.0170.20762.87
5.3.170.0200.20062.76
5.3.160.0200.21062.91
5.3.150.0200.18762.91
5.3.140.0200.25362.83
5.3.130.0230.19062.82
5.3.120.0270.23762.78
5.3.110.0270.24362.82
5.3.100.0200.26362.30
5.3.90.0170.25762.33
5.3.80.0400.21762.12
5.3.70.0130.26762.20
5.3.60.0230.25762.05
5.3.50.0300.24062.14
5.3.40.0200.19362.00
5.3.30.0230.18762.08
5.3.20.0100.23761.92
5.3.10.0170.35361.85
5.3.00.0300.35761.74
5.2.170.0130.17357.39
5.2.160.0230.24057.61
5.2.150.0270.21357.59
5.2.140.0100.23757.39
5.2.130.0200.22757.52
5.2.120.0170.23757.89
5.2.110.0130.17357.56
5.2.100.0200.17057.53
5.2.90.0270.18357.64
5.2.80.0270.18757.90
5.2.70.0170.22757.54
5.2.60.0170.17057.50
5.2.50.0230.18757.32
5.2.40.0130.18357.14
5.2.30.0330.23357.29
5.2.20.0070.37357.45
5.2.10.0100.36057.32
5.2.00.0300.38757.16
5.1.60.0130.41371.75
5.1.50.0200.41771.54
5.1.40.0200.35771.66
5.1.30.0300.42072.09
5.1.20.0270.42072.11
5.1.10.0130.38071.71
5.1.00.0170.42071.80
5.0.50.0130.45370.32
5.0.40.0370.43370.13
5.0.30.1170.43069.97
5.0.20.0230.43769.96
5.0.10.0130.45069.82
5.0.00.0370.42369.84
4.4.90.0300.29767.73
4.4.80.0170.43767.63
4.4.70.0130.38367.67
4.4.60.0230.37067.72
4.4.50.0170.33367.73
4.4.40.0130.40367.64
4.4.30.0100.36767.66
4.4.20.0200.36767.79
4.4.10.0100.34767.68
4.4.00.0200.37767.74
4.3.110.0130.38067.65
4.3.100.0270.35067.54
4.3.90.0200.35367.53
4.3.80.0200.41067.63
4.3.70.0200.38367.59
4.3.60.0300.36067.52
4.3.50.0230.40767.79
4.3.40.0130.41367.81
4.3.30.0130.40366.50
4.3.20.0200.34366.52
4.3.10.0230.40766.55
4.3.00.0200.41366.51

preferences:
36 ms | 400 KiB | 5 Q