proposal control-structures.for.php
| From: | Oliver Block | Date: | Tue, 29 Aug 2006 14:29:07 +0000 |
| Subject: | proposal control-structures.for.php | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969373853@lists.php.net to get a copy of this message | ||
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