Re: Re: PHP 4.0 Bug #4203 Updated: each() does not reset() array. each() only works the first time.
| From: | Zeev Suraski | Date: | Thu, 20 Apr 2000 19:47:03 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #4203 Updated: each() does not reset() array. each() only works the first time. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-18082@lists.php.net to get a copy of this message | ||
On Thu, 20 Apr 2000, Kai Mantsch wrote:
> I guess my assumption is more that after the last
> element is returned (and then a null to signify the
> end of the loop), the pointer would reset to the first
> element of the array (which is apparently not the
> case.)
>
> Should this not be true?
It's not the documented behavior of this function. I'm not sure if it has
negative implications or not, but generally, you shouldn't rely on the
status of the array before your first call to each(), and should reset it
manually.
Zeev