On 3/22/07, Jake McHenry <[EMAIL PROTECTED]> wrote:
does this help?
http://www.php.lt/benchmark/phpbench.php
Jake
Well, there wasn't a test between For and While, so i did it myself,
and i'm quite confused about the result.
I let PHP count from 0 to 100000000 on my 1ghz AMD Athlon.
While did it in a average time of 55 seconds.
For did it in a average time of 59 seconds.
It's not a big difference, if you see what number it needs to go to,
but there is a difference.
code used:
<?php
set_time_limit(100000);
echo date("H:i:s");
for($i = 0; $i < 100000000;$i++)
{
}
echo date("H:i:s");
$x = 0;
while($x < 100000000)
{
$x++;
}
echo date("H:i:s");
?>
So, use while loops instead of for loops ;)
Tijnema
ps. I also did the while loop before the for loop, doesn't matter.
> -----Original Message-----
> From: Tijnema ! [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 22, 2007 4:38 PM
> To: PHP
> Subject: [PHP] Performance: While or For loop
>
> Hi,
>
> Does somebody has benchmarks of what is faster, while or for loop?
>
> Thanks,
>
> Tijnema
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.17/730 - Release
> Date: 3/22/2007 7:44 AM
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 3/22/2007
7:44 AM
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php