|
Posted by trlists on 02/11/05 05:18
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
Navigation:
[Reply to this message]
|