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

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

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

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

page generated in 8.117 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 2024-04-21 08:06:06