Re: Foreach problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 Feb 2005 Richard Lynch wrote:

> Perhaps you need to use http://php.net/reset
> 
> You see, when you do foreach or each or any of those, there is an
> "internal" setting in the array that is altered to keep track of where you
> are.  Kind of like a big "You are here" arrow inside the guts of the
> array.

I believe this is incorrect.  Or if not, the docs are wrong.  From 
http://www.php.net/manual/en/control-structures.foreach.php:

    Note:  When foreach first starts executing, the internal array
    pointer is automatically reset to the first element of the array.
    This means that you do not need to call reset() before a foreach 
    loop.

I don't know why the original poster had a problem, it seems mysterious 
so far, but it seems it probably wasn't for lack of a reset() call.

--
Tom

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux