Re: for/foreach speed
| From: | Sascha Braun, CEO @ fit-o-matic | Date: | Mon, 20 Aug 2007 18:13:55 +0000 |
| Subject: | Re: for/foreach speed | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261056@lists.php.net to get a copy of this message | ||
Thank you very much. When we might have time for testing we can
wager :))
Am Montag, den 20.08.2007, 13:21 -0400 schrieb Robert Cummings:
> On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic
> wrote:
> > Hi people,
> >
> > could somebody please explain me, what loop construct is
> > faster? The for, while or foreach.
>
> I haven't bothered testing but I'd wager $5 that the following is the
> fastest loop:
>
> <?php
>
> while( 1 )
> {
> }
>
> ?>
>
> Depending on bytecode creation though, the following might be just as
> fast:
>
> <?php
>
> for( ;; )
> {
> }
>
> ?>
>
> Cheers,
> Rob.