3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(0, 50000); $n = 300; $t = microtime(true); for ($i = 0; $i < $n; $i++) { foreach ($array as $v) { } } var_dump(microtime(true) - $t); $t = microtime(true); for ($i = 0; $i < $n; $i++) { for ($j = 0, $c = count($array); $j < $c; $j++) { $v = $array[$j]; } } var_dump(microtime(true) - $t);
Output for 7.1.4
float(0.1540060043335) float(0.44501709938049)
Output for 7.1.3
float(0.14085793495178) float(0.36032795906067)
Output for 7.1.2
float(0.14077186584473) float(0.35948395729065)
Output for 7.1.1
float(0.17004299163818) float(0.375648021698)
Output for 7.1.0
float(0.29643702507019) float(0.50113916397095)
Output for 7.0.18
float(0.30185484886169) float(0.6729531288147)
Output for 7.0.17
float(0.14567184448242) float(0.64644598960876)
Output for 7.0.16
float(0.26539707183838) float(0.59652090072632)
Output for 7.0.15
float(0.15857601165771) float(0.42639207839966)
Output for 7.0.14
float(0.28328895568848) float(0.78706002235413)
Output for 7.0.13
float(0.14279794692993) float(0.44907402992249)
Output for 7.0.12
float(0.18331813812256) float(0.55059599876404)
Output for 7.0.11
float(0.26343202590942) float(0.44922590255737)
Output for 7.0.10
float(0.23153901100159) float(0.5537428855896)
Output for 7.0.9
float(0.14245796203613) float(0.53235983848572)
Output for 7.0.8
float(0.23434209823608) float(0.54957699775696)
Output for 7.0.7
float(0.14690494537354) float(0.43424296379089)
Output for 7.0.6
float(0.24277496337891) float(0.39993500709534)
Output for 7.0.5
float(0.14574313163757) float(0.57578182220459)
Output for 7.0.4
float(0.13752508163452) float(0.70563507080078)
Output for 7.0.3
float(0.14366316795349) float(0.4412579536438)
Output for 7.0.2
float(0.20273184776306) float(0.41883397102356)
Output for 7.0.1
float(0.14818501472473) float(0.40784811973572)
Output for 7.0.0
float(0.14582490921021) float(0.41766095161438)