Re: PHP 4.0 Bug #4203 Updated: each() does not reset() array. each() only works the first time.
| From: | Kai Mantsch | Date: | Thu, 20 Apr 2000 19:42:36 +0000 |
| Subject: | Re: PHP 4.0 Bug #4203 Updated: each() does not reset() array. each() only works the first time. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18080@lists.php.net to get a copy of this message | ||
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?
Kai
--- Bug Database <php-dev@lists.php.net> wrote:
> ID: 4203
> Updated by: zeev
> Reported By: kai@jedi.net
> Status: Closed
> Bug Type: Misbehaving function
> Assigned To:
> Comments:
>
> each() is not supposed to reset the array. If it
> did, it would have always returned the first
> element. You must reset the array yourself before
> calling each().
>
> Alternately, you can use the foreach() loop in PHP
> 4.0
>
> Full Bug description available at:
> http://bugs.php.net/version4/?id=4203
>
>
__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com