Re: foreach vs. while(list() = each())
| From: | Brian Clark | Date: | Thu, 12 Apr 2001 07:45:39 +0000 |
| Subject: | Re: foreach vs. while(list() = each()) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48260@lists.php.net to get a copy of this message | ||
Hi Maxim,
@ 3:39:55 AM on 4/12/2001, Maxim Derkachev wrote:
> Hello Joe,
> Wednesday, April 11, 2001, 10:49:31 PM, you wrote:
JS>> What are the differences in these? I know with while() you have to reset() the
JS>> array afterwards, but foreach() you don't. Also foreach() appears to be quite
JS>> a bit faster.
> You don't need to reset() the array, You also don't need list() and
> each(), which impose additional overhead. You put the array loop to the foreach()
> implementation, which is in C, instead of implementing it with PHP with while(),
> list() and each().
> That must be a lot faster.
-Brian
--
PGP is spoken here: 0xE4D0C7C8
Please do not carbon copy me on list replies.