edainworks.com :: VGR :: Benchmarking foreach() solutions on a big array of size=200000.

while(list()=each())
foofunc : Array

page generated in 344.734 ms
foreach($array as $key=>$val)
foofunc : Array

page generated in 178.645 ms
$dim=count($array);
for($i;$i<$dim;$i++)
foofunc : theval1

page generated in 190.188 ms

9. Conclusion top

FR

En conclusion le while(list=each) est décommandé et les deux autres méthodes se valent.
Cordialement,

EN

Conclusion : while(list=each) is the worse ; the two others are equivalent.
Best regards,

Vincent Graux (VGR) for European Experts Exchange and Edaěn Works  back to list of test scripts
Last update 2009-10-30 09:19:06

 Add This Article To:
 del.icio.usDel.icio.us  diggDigg  googleGoogle  spurlSpurl
 blinkBlink  furlFurl  simpySimpy  yahooY! MyWeb