3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $parameters = array(); $lines = range(1,1000); $start = microtime(true); while ($name = array_shift($lines)) { $parameters[$name] = array_shift($lines); } $end = microtime(true); echo ($end-$start)." (while loop)\n"; $parameters2 = array(); $lines2 = range(1,1000); $start = microtime(true); $linescount = count($lines2); for($i = 0; $i < $linescount; $i++){ $name = $lines2[$i]; $i++; $parameters2[$name] = $lines2[$i]; } $end = microtime(true); echo ($end-$start)." (for loop)\n"; if($parameters === $parameters2){ echo "they are equal\n"; }
Output for 7.2.6
0.0018310546875 (while loop) 2.5033950805664E-5 (for loop) they are equal
Output for 7.2.0
0.0023789405822754 (while loop) 3.7908554077148E-5 (for loop) they are equal
Output for 7.1.10
0.0020380020141602 (while loop) 4.1961669921875E-5 (for loop) they are equal
Output for 7.1.7
0.002223014831543 (while loop) 3.814697265625E-5 (for loop) they are equal
Output for 7.1.6
0.0071210861206055 (while loop) 6.4849853515625E-5 (for loop) they are equal
Output for 7.1.5
0.002979040145874 (while loop) 7.2956085205078E-5 (for loop) they are equal
Output for 7.1.4
0.0023031234741211 (while loop) 5.1021575927734E-5 (for loop) they are equal
Output for 7.1.3
0.0023260116577148 (while loop) 5.8174133300781E-5 (for loop) they are equal
Output for 7.1.2
0.004486083984375 (while loop) 5.1021575927734E-5 (for loop) they are equal
Output for 7.1.1
0.0021331310272217 (while loop) 5.0067901611328E-5 (for loop) they are equal
Output for 7.1.0
0.0021059513092041 (while loop) 7.0095062255859E-5 (for loop) they are equal
Output for 7.0.20
0.0033109188079834 (while loop) 9.3936920166016E-5 (for loop) they are equal
Output for 7.0.19
0.0032258033752441 (while loop) 6.7949295043945E-5 (for loop) they are equal
Output for 7.0.18
0.0026240348815918 (while loop) 9.3936920166016E-5 (for loop) they are equal
Output for 7.0.17
0.0023181438446045 (while loop) 0.0001988410949707 (for loop) they are equal
Output for 7.0.16
0.0042579174041748 (while loop) 6.2942504882812E-5 (for loop) they are equal
Output for 7.0.15
0.0033280849456787 (while loop) 8.6069107055664E-5 (for loop) they are equal
Output for 7.0.14
0.0021800994873047 (while loop) 6.3896179199219E-5 (for loop) they are equal
Output for 7.0.13
0.0020937919616699 (while loop) 6.2942504882812E-5 (for loop) they are equal
Output for 7.0.12
0.0032742023468018 (while loop) 9.1075897216797E-5 (for loop) they are equal
Output for 7.0.11
0.0023300647735596 (while loop) 8.2015991210938E-5 (for loop) they are equal
Output for 7.0.10
0.0020339488983154 (while loop) 0.00010418891906738 (for loop) they are equal
Output for 7.0.9
0.0020320415496826 (while loop) 9.2983245849609E-5 (for loop) they are equal
Output for 7.0.8
0.0028619766235352 (while loop) 8.6069107055664E-5 (for loop) they are equal
Output for 7.0.7
0.0021851062774658 (while loop) 8.702278137207E-5 (for loop) they are equal
Output for 7.0.6
0.0020599365234375 (while loop) 6.413459777832E-5 (for loop) they are equal
Output for 7.0.5
0.0020589828491211 (while loop) 7.9870223999023E-5 (for loop) they are equal
Output for 7.0.4
0.0020849704742432 (while loop) 6.3896179199219E-5 (for loop) they are equal
Output for 7.0.3
0.0021090507507324 (while loop) 0.00010108947753906 (for loop) they are equal
Output for 7.0.2
0.0020239353179932 (while loop) 8.702278137207E-5 (for loop) they are equal
Output for 7.0.1
0.0029869079589844 (while loop) 8.0108642578125E-5 (for loop) they are equal
Output for 7.0.0
0.0022590160369873 (while loop) 8.2969665527344E-5 (for loop) they are equal
Output for hhvm-3.15.4
0.00036001205444336 (while loop) 0.00021600723266602 (for loop) they are equal
Output for 5.6.30
0.0046529769897461 (while loop) 0.00013399124145508 (for loop) they are equal
Output for 5.6.29
0.005436897277832 (while loop) 0.00017595291137695 (for loop) they are equal
Output for 5.6.28
0.0039060115814209 (while loop) 0.00012397766113281 (for loop) they are equal
Output for 5.6.27
0.0036790370941162 (while loop) 0.00015497207641602 (for loop) they are equal
Output for 5.6.26
0.004723072052002 (while loop) 0.0001220703125 (for loop) they are equal
Output for 5.6.25
0.0054769515991211 (while loop) 0.00026082992553711 (for loop) they are equal
Output for 5.6.24
0.0036771297454834 (while loop) 0.00016379356384277 (for loop) they are equal
Output for 5.6.23
0.0076248645782471 (while loop) 0.00024008750915527 (for loop) they are equal
Output for 5.6.22
0.0046360492706299 (while loop) 0.00015401840209961 (for loop) they are equal
Output for 5.6.21
0.0044500827789307 (while loop) 0.00013613700866699 (for loop) they are equal
Output for 5.6.20
0.0036420822143555 (while loop) 0.00012803077697754 (for loop) they are equal
Output for 5.6.19
0.0038321018218994 (while loop) 0.00016212463378906 (for loop) they are equal
Output for 5.6.18
0.0048000812530518 (while loop) 0.00015783309936523 (for loop) they are equal
Output for 5.6.17
0.0036239624023438 (while loop) 0.00015497207641602 (for loop) they are equal
Output for 5.6.16
0.0040290355682373 (while loop) 0.00016593933105469 (for loop) they are equal
Output for 5.6.15
0.005659818649292 (while loop) 0.00017786026000977 (for loop) they are equal
Output for 5.6.14
0.0039849281311035 (while loop) 0.00013113021850586 (for loop) they are equal
Output for 5.6.13
0.0036230087280273 (while loop) 0.00013399124145508 (for loop) they are equal
Output for 5.6.12
0.003648042678833 (while loop) 0.00012779235839844 (for loop) they are equal
Output for 5.6.11
0.004439115524292 (while loop) 0.00016498565673828 (for loop) they are equal
Output for 5.6.10
0.004601001739502 (while loop) 0.00014710426330566 (for loop) they are equal
Output for 5.6.9
0.0037291049957275 (while loop) 0.00012993812561035 (for loop) they are equal
Output for 5.6.8
0.0043840408325195 (while loop) 0.00015997886657715 (for loop) they are equal
Output for 5.6.7
0.009099006652832 (while loop) 0.00012707710266113 (for loop) they are equal
Output for 5.6.6
0.0044779777526855 (while loop) 0.00012087821960449 (for loop) they are equal
Output for 5.6.5
0.0049018859863281 (while loop) 0.00018000602722168 (for loop) they are equal
Output for 5.6.4
0.0035190582275391 (while loop) 0.0001370906829834 (for loop) they are equal
Output for 5.6.3
0.0035941600799561 (while loop) 0.00016903877258301 (for loop) they are equal
Output for 5.6.2
0.0035500526428223 (while loop) 0.00016093254089355 (for loop) they are equal
Output for 5.6.1
0.0037229061126709 (while loop) 0.00016403198242188 (for loop) they are equal
Output for 5.6.0
0.0058939456939697 (while loop) 0.00016212463378906 (for loop) they are equal