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

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

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

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

page generated in 8.111 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

First Edition : 24/05/2003
Last update 2024-05-25 14:44:39