|
Posted by John Nichel on 01/13/05 23:22
Ford, Mike wrote:
<snip>
> Without actually running it (I'm too lazy!), I'm pretty sure this won't work
> correctly -- the count($array) is being recalculated each time round the
> loop, so each time you do an unset() it will reduce by one, resulting in the
> last few elements never being checked.
</snip>
Not too much on this topic, but to save youself a few cpu cycles, you
could put your size outside of the for loop
$size = sizeof ( $array );
for ( $i = 0; $i < $size; $i++ )
Putting it inside the for() makes it call that function on every loop.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com
Navigation:
[Reply to this message]
|