For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > August 2006 > proposal control-structures.for.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author proposal control-structures.for.php
Oliver Block

2006-08-29, 6:58 pm

Hi list,

could someone add a paragraph to the end of 'control-structures.for.php' that
it's not recommended to use count() in arg2 especially when the for loop is
used to unset elements of an array, because the function will be executed
every loop.

I mean:

for($i=0; $i<count($myarray); $i++)
...

instead:

$count = count(myarray);
for($i=0; $i<$count; $i++)
...

Best Regards,

Oliver

--
Leben ist mehr als schneller - weiter - höher
http://www.nak-nrw.de/p_6_4.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com