On Wed, Jun 9, 2010 at 21:49, Shreyas <[email protected]> wrote:
> PHP'ers,
>
> I am reading a PHP book which explains foreach and at the end says : *'When
> foreach starts walking through an array, it moves the pointer to
> the beginning of the array. You don’t need to reset an array before
> walking through it with foreach.'*
> *
> *
> *Does this mean - *
[snip!]

    An easy way to think about it: foreach is cocky and doesn't give a
damn about the rules array functions or placements have set in place.
It'll start from the beginning, and to hell with everyone else.

    In other words: foreach will iterate wholly; it will count *for*
*each* key in the loop, not just where another portion of the code
left off.

-- 
</Daniel P. Brown>
[email protected] || [email protected]
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to