3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $parameters = array(); $lines = range(1,10000); $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,10000); $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";
based on 95c53
Output for 7.2.11
0.21352195739746 (while loop) 0.00027108192443848 (for loop)
Output for 7.2.10
0.22252988815308 (while loop) 0.0002751350402832 (for loop)
Output for 7.2.9
0.22089195251465 (while loop) 0.00028896331787109 (for loop)
Output for 7.2.8
0.21314382553101 (while loop) 0.00027990341186523 (for loop)
Output for 7.2.7
0.22188401222229 (while loop) 0.00026106834411621 (for loop)
Output for 7.2.6
0.21393799781799 (while loop) 0.00026798248291016 (for loop)
Output for 7.2.5
0.20564198493958 (while loop) 0.00025701522827148 (for loop)
Output for 7.2.4
0.23071312904358 (while loop) 0.00039005279541016 (for loop)
Output for 7.2.3
0.23084187507629 (while loop) 0.00026392936706543 (for loop)
Output for 7.2.2
0.21541595458984 (while loop) 0.00027084350585938 (for loop)
Output for 7.2.1
0.21393895149231 (while loop) 0.00026297569274902 (for loop)
Output for 7.2.0
0.22172999382019 (while loop) 0.00032401084899902 (for loop)
Output for 7.1.23
0.214919090271 (while loop) 0.00027203559875488 (for loop)
Output for 7.1.22
0.21903514862061 (while loop) 0.0004119873046875 (for loop)
Output for 7.1.21
0.21362900733948 (while loop) 0.00037002563476562 (for loop)
Output for 7.1.20
0.21307301521301 (while loop) 0.00028300285339355 (for loop)
Output for 7.1.19
0.20656704902649 (while loop) 0.00025796890258789 (for loop)
Output for 7.1.18
0.21735787391663 (while loop) 0.00026702880859375 (for loop)
Output for 7.1.17
0.22698998451233 (while loop) 0.00029301643371582 (for loop)
Output for 7.1.16
0.21317291259766 (while loop) 0.00042915344238281 (for loop)
Output for 7.1.15
0.2263650894165 (while loop) 0.00039100646972656 (for loop)
Output for 7.1.14
0.21631789207458 (while loop) 0.00027608871459961 (for loop)
Output for 7.1.13
0.21658492088318 (while loop) 0.00031113624572754 (for loop)
Output for 7.1.12
0.2127161026001 (while loop) 0.00034809112548828 (for loop)
Output for 7.1.11
0.21738219261169 (while loop) 0.0002751350402832 (for loop)
Output for 7.1.10
0.22987794876099 (while loop) 0.00026822090148926 (for loop)
Output for 7.1.9
0.2135009765625 (while loop) 0.00039100646972656 (for loop)
Output for 7.1.8
0.21742105484009 (while loop) 0.00027179718017578 (for loop)
Output for 7.1.7
0.21597504615784 (while loop) 0.00026798248291016 (for loop)
Output for 7.1.6
0.22737097740173 (while loop) 0.00026488304138184 (for loop)
Output for 7.1.5
0.2168550491333 (while loop) 0.00026798248291016 (for loop)
Output for 7.1.4
0.21235322952271 (while loop) 0.00029206275939941 (for loop)
Output for 7.1.3
0.2165310382843 (while loop) 0.00027108192443848 (for loop)
Output for 7.1.2
0.213054895401 (while loop) 0.00026607513427734 (for loop)
Output for 7.1.1
0.21358895301819 (while loop) 0.00027918815612793 (for loop)
Output for 7.1.0
0.21648192405701 (while loop) 0.00026488304138184 (for loop)
Output for 7.0.31
0.21216797828674 (while loop) 0.00026607513427734 (for loop)
Output for 7.0.30
0.21710085868835 (while loop) 0.0003819465637207 (for loop)
Output for 7.0.29
0.21170210838318 (while loop) 0.00028681755065918 (for loop)
Output for 7.0.28
0.22888493537903 (while loop) 0.00027084350585938 (for loop)
Output for 7.0.27
0.22436594963074 (while loop) 0.00028109550476074 (for loop)
Output for 7.0.26
0.21601796150208 (while loop) 0.00031495094299316 (for loop)
Output for 7.0.25
0.22702980041504 (while loop) 0.00027990341186523 (for loop)
Output for 7.0.24
0.21161317825317 (while loop) 0.00029206275939941 (for loop)
Output for 7.0.23
0.21317505836487 (while loop) 0.00030398368835449 (for loop)
Output for 7.0.22
0.22083592414856 (while loop) 0.00028204917907715 (for loop)
Output for 7.0.21
0.21920609474182 (while loop) 0.00028896331787109 (for loop)
Output for 7.0.20
0.23057389259338 (while loop) 0.00046110153198242 (for loop)
Output for 7.0.19
0.21496510505676 (while loop) 0.00028610229492188 (for loop)
Output for 7.0.18
0.21691203117371 (while loop) 0.00028800964355469 (for loop)
Output for 7.0.17
0.22420692443848 (while loop) 0.00027894973754883 (for loop)
Output for 7.0.16
0.2194299697876 (while loop) 0.00034189224243164 (for loop)
Output for 7.0.15
0.21441602706909 (while loop) 0.00027894973754883 (for loop)
Output for 7.0.14
0.21957612037659 (while loop) 0.00031495094299316 (for loop)
Output for 7.0.13
0.21172499656677 (while loop) 0.00027799606323242 (for loop)
Output for 7.0.12
0.22587895393372 (while loop) 0.00028491020202637 (for loop)
Output for 7.0.11
0.22231388092041 (while loop) 0.00027608871459961 (for loop)
Output for 7.0.10
0.22083806991577 (while loop) 0.00027918815612793 (for loop)
Output for 7.0.9
0.21529603004456 (while loop) 0.00027990341186523 (for loop)
Output for 7.0.8
0.21933698654175 (while loop) 0.00030398368835449 (for loop)
Output for 7.0.7
0.21321797370911 (while loop) 0.00029301643371582 (for loop)
Output for 7.0.6
0.21915602684021 (while loop) 0.00033712387084961 (for loop)
Output for 7.0.5
0.21183800697327 (while loop) 0.00028014183044434 (for loop)
Output for 7.0.4
0.2137291431427 (while loop) 0.00027608871459961 (for loop)
Output for 7.0.3
0.22206902503967 (while loop) 0.00034189224243164 (for loop)
Output for 7.0.2
0.2158899307251 (while loop) 0.00028109550476074 (for loop)
Output for 7.0.1
0.21589493751526 (while loop) 0.00029897689819336 (for loop)
Output for 7.0.0
0.21397590637207 (while loop) 0.00028204917907715 (for loop)
Output for hhvm-3.22.0
0.027041435241699 (while loop) 0.00098538398742676 (for loop)
Output for hhvm-3.21.3
0.027409076690674 (while loop) 0.00099611282348633 (for loop)
Output for hhvm-3.21.0
0.027145624160767 (while loop) 0.0010244846343994 (for loop)
Output for hhvm-3.20.2
0.025938034057617 (while loop) 0.0010256767272949 (for loop)
Output for hhvm-3.19.2
0.027792692184448 (while loop) 0.00095939636230469 (for loop)
Output for hhvm-3.18.5
0.0258469581604 (while loop) 0.0011539459228516 (for loop)
Output for hhvm-3.18.4
0.025775909423828 (while loop) 0.0011508464813232 (for loop)
Output for hhvm-3.15.4
0.028424024581909 (while loop) 0.0013329982757568 (for loop)
Output for 5.6.38
0.45716404914856 (while loop) 0.0010750293731689 (for loop)
Output for 5.6.30
0.73519420623779 (while loop) 0.0019130706787109 (for loop)
Output for 5.6.29
0.69770407676697 (while loop) 0.0017800331115723 (for loop)
Output for 5.6.28
0.73444199562073 (while loop) 0.0012779235839844 (for loop)
Output for 5.6.27
0.69823813438416 (while loop) 0.0017290115356445 (for loop)
Output for 5.6.26
0.71293187141418 (while loop) 0.0016229152679443 (for loop)
Output for 5.6.25
0.83217000961304 (while loop) 0.0012869834899902 (for loop)
Output for 5.6.24
0.69683408737183 (while loop) 0.0016610622406006 (for loop)
Output for 5.6.23
0.70132207870483 (while loop) 0.0013980865478516 (for loop)
Output for 5.6.22
0.73531699180603 (while loop) 0.0017318725585938 (for loop)
Output for 5.6.21
0.6906270980835 (while loop) 0.0021011829376221 (for loop)
Output for 5.6.20
0.7338080406189 (while loop) 0.0017929077148438 (for loop)
Output for 5.6.19
0.70382785797119 (while loop) 0.0018701553344727 (for loop)
Output for 5.6.18
0.69832015037537 (while loop) 0.0017499923706055 (for loop)
Output for 5.6.17
0.68227291107178 (while loop) 0.0016388893127441 (for loop)
Output for 5.6.16
0.73848104476929 (while loop) 0.0018200874328613 (for loop)
Output for 5.6.15
0.67816209793091 (while loop) 0.0017361640930176 (for loop)
Output for 5.6.14
0.69772696495056 (while loop) 0.0017578601837158 (for loop)
Output for 5.6.13
0.69012999534607 (while loop) 0.001690149307251 (for loop)
Output for 5.6.12
0.72850012779236 (while loop) 0.0020267963409424 (for loop)
Output for 5.6.11
0.71095085144043 (while loop) 0.0020368099212646 (for loop)
Output for 5.6.10
0.70489907264709 (while loop) 0.0018620491027832 (for loop)
Output for 5.6.9
0.69605612754822 (while loop) 0.0018179416656494 (for loop)
Output for 5.6.8
0.76852107048035 (while loop) 0.002371072769165 (for loop)
Output for 5.6.7
0.70696687698364 (while loop) 0.001849889755249 (for loop)
Output for 5.6.6
0.70049595832825 (while loop) 0.001716136932373 (for loop)
Output for 5.6.5
0.72776699066162 (while loop) 0.0022528171539307 (for loop)
Output for 5.6.4
0.71686697006226 (while loop) 0.0020101070404053 (for loop)
Output for 5.6.3
0.66364002227783 (while loop) 0.001446008682251 (for loop)
Output for 5.6.2
0.69492602348328 (while loop) 0.001446008682251 (for loop)
Output for 5.6.1
0.73505592346191 (while loop) 0.0017619132995605 (for loop)
Output for 5.6.0
0.68420600891113 (while loop) 0.0017430782318115 (for loop)