Re: Unnecessary if statement? Programming technique
| From: | David Grant | Date: | Tue, 06 Dec 2005 15:46:57 +0000 |
| Subject: | Re: Unnecessary if statement? Programming technique | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226940@lists.php.net to get a copy of this message | ||
Jared Williams wrote:
> Why not
>
> for ($i = 0; $i < 1000000/100; ++$i)
This involves dividing 1000000 by 100 for each iteration of the loop.
It would be better to test against 10000.
There is also the unwanted side-effect of executing the code on each
hundredth iteration, which is unwanted (as far as I understand the
problem). :)
It would be interesting if Steve could divulge the greater problem that
he is seeking a solution to.
Cheers,
David
--
David Grant
http://www.grant.org.uk/