3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $parameters = array(); $lines = range(1,100); $start = microtime(true); while ($name = array_shift($lines)) { $parameters[$name] = array_shift($lines); } $end = microtime(true); echo ($end-$start)." (while loop)\n"; $parameters2 = array(); $lines = range(1,100); $start = microtime(true); $linescount = count($lines); for($i = 0; $i < $linescount; $i++){ $name = $lines[$i]; $i++; $parameters2[$name] = $lines[$i]; } $end = microtime(true); echo ($end-$start)." (for loop)\n";
based on 95c53
Output for 7.2.6
5.2213668823242E-5 (while loop) 0.00010180473327637 (for loop)
Output for 7.0.11, 7.2.0
3.6954879760742E-5 (while loop) 1.0013580322266E-5 (for loop)
Output for 7.1.10
3.504753112793E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for 7.1.7
2.5033950805664E-5 (while loop) 4.0531158447266E-6 (for loop)
Output for 7.1.6
3.9100646972656E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for 7.1.5
4.1007995605469E-5 (while loop) 9.0599060058594E-6 (for loop)
Output for 7.1.4
4.1007995605469E-5 (while loop) 7.1525573730469E-6 (for loop)
Output for 7.1.3
0.00012898445129395 (while loop) 1.0967254638672E-5 (for loop)
Output for 7.1.2
4.9114227294922E-5 (while loop) 7.8678131103516E-6 (for loop)
Output for 7.1.1
4.1007995605469E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for 7.1.0
4.1007995605469E-5 (while loop) 7.8678131103516E-6 (for loop)
Output for 7.0.20
3.814697265625E-5 (while loop) 3.1948089599609E-5 (for loop)
Output for 7.0.19
3.7193298339844E-5 (while loop) 1.0967254638672E-5 (for loop)
Output for 7.0.18
3.6001205444336E-5 (while loop) 1.0013580322266E-5 (for loop)
Output for 7.0.7, 7.0.17
3.6954879760742E-5 (while loop) 9.0599060058594E-6 (for loop)
Output for 7.0.16
3.7908554077148E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for 7.0.0, 7.0.15
3.6954879760742E-5 (while loop) 7.8678131103516E-6 (for loop)
Output for 7.0.2 - 7.0.3, 7.0.14
3.6001205444336E-5 (while loop) 7.8678131103516E-6 (for loop)
Output for 7.0.1, 7.0.12 - 7.0.13
3.6954879760742E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for 7.0.10
3.6001205444336E-5 (while loop) 9.0599060058594E-6 (for loop)
Output for 7.0.9
3.6954879760742E-5 (while loop) 8.8214874267578E-6 (for loop)
Output for 7.0.8
3.7193298339844E-5 (while loop) 1.0013580322266E-5 (for loop)
Output for 7.0.6
3.6001205444336E-5 (while loop) 1.0967254638672E-5 (for loop)
Output for 7.0.5
5.6028366088867E-5 (while loop) 1.1205673217773E-5 (for loop)
Output for 7.0.4
6.103515625E-5 (while loop) 8.1062316894531E-6 (for loop)
Output for hhvm-3.15.4
2.7894973754883E-5 (while loop) 3.0994415283203E-5 (for loop)
Output for 5.6.30
4.3869018554688E-5 (while loop) 1.4066696166992E-5 (for loop)
Output for 5.6.29
6.0081481933594E-5 (while loop) 1.3828277587891E-5 (for loop)
Output for 5.6.28
4.6014785766602E-5 (while loop) 1.5020370483398E-5 (for loop)
Output for 5.6.27
4.4107437133789E-5 (while loop) 4.2915344238281E-5 (for loop)
Output for 5.6.26
4.6014785766602E-5 (while loop) 1.6927719116211E-5 (for loop)
Output for 5.6.8, 5.6.25
4.2915344238281E-5 (while loop) 1.4066696166992E-5 (for loop)
Output for 5.6.24
4.4107437133789E-5 (while loop) 1.4066696166992E-5 (for loop)
Output for 5.6.23
4.2915344238281E-5 (while loop) 2.0027160644531E-5 (for loop)
Output for 5.6.22
4.4107437133789E-5 (while loop) 1.3828277587891E-5 (for loop)
Output for 5.6.21
4.6014785766602E-5 (while loop) 1.9073486328125E-5 (for loop)
Output for 5.6.20
4.3869018554688E-5 (while loop) 1.3828277587891E-5 (for loop)
Output for 5.6.19
5.5074691772461E-5 (while loop) 1.4066696166992E-5 (for loop)
Output for 5.6.18
4.6968460083008E-5 (while loop) 1.6927719116211E-5 (for loop)
Output for 5.6.17
9.7990036010742E-5 (while loop) 2.1934509277344E-5 (for loop)
Output for 5.6.16
5.1975250244141E-5 (while loop) 1.4066696166992E-5 (for loop)
Output for 5.6.15
6.7949295043945E-5 (while loop) 1.4781951904297E-5 (for loop)
Output for 5.6.14
5.4836273193359E-5 (while loop) 1.5020370483398E-5 (for loop)
Output for 5.6.13
4.5061111450195E-5 (while loop) 1.4781951904297E-5 (for loop)
Output for 5.6.12
4.2915344238281E-5 (while loop) 1.8835067749023E-5 (for loop)
Output for 5.6.11
4.3869018554688E-5 (while loop) 1.5974044799805E-5 (for loop)
Output for 5.6.10
4.4107437133789E-5 (while loop) 3.9100646972656E-5 (for loop)
Output for 5.6.9
4.3869018554688E-5 (while loop) 1.5020370483398E-5 (for loop)
Output for 5.6.7
6.6995620727539E-5 (while loop) 3.0994415283203E-5 (for loop)
Output for 5.6.6
4.887580871582E-5 (while loop) 1.7166137695312E-5 (for loop)
Output for 5.6.5
4.5061111450195E-5 (while loop) 1.3828277587891E-5 (for loop)
Output for 5.6.4
4.4107437133789E-5 (while loop) 1.5974044799805E-5 (for loop)
Output for 5.6.3
4.5061111450195E-5 (while loop) 1.5020370483398E-5 (for loop)
Output for 5.6.2
4.4107437133789E-5 (while loop) 1.5020370483398E-5 (for loop)
Output for 5.6.1
6.9856643676758E-5 (while loop) 2.1934509277344E-5 (for loop)
Output for 5.6.0
4.2915344238281E-5 (while loop) 1.9073486328125E-5 (for loop)