Re: [PHP] for/foreach speed

2007-08-26 Thread Richard Lynch
On Mon, August 20, 2007 11:50 am, Sascha Braun, CEO @ fit-o-matic wrote:
 could somebody please explain me, what loop construct is
 faster? The for, while or foreach.

If you are doing anything where the speed of for/while/foreach
matters, you shouldn't have done that in PHP in the first place, but
should have put it into a custom PHP extension. :-)


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] for/foreach speed

2007-08-20 Thread Sascha Braun, CEO @ fit-o-matic
Hi people,

could somebody please explain me, what loop construct is
faster? The for, while or foreach.

I at the moment don't know if there are more.

And thanks to the person who is missusing the list here
for sending trojan horses everywhere.

Since I write to the PHP General list I am receiving round
about 5 E-Mails from random domains, from this list, containing
a Jpeg image with an embeded trojan horse.

Thats really wonderfull. But maybe I should say, that we are
using a nice mailscanner, and as well we are only working on
linux machines.

So better find another way of performing your frauds.

If there are people here in the list, who would like to discuss
how its possible to fight this kind of fraud. I am very open to
that.

Get the hacking tools prepared and lets fight back. I am sure
the police would love to get an inquiry from a hole bunch of
senior developers wanting to see little assholes in jail!

Best Regards,

Sascha Braun

--
BRAUN Networks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] for/foreach speed

2007-08-20 Thread 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.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] for/foreach speed

2007-08-20 Thread Sascha Braun, CEO @ fit-o-matic
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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php