note 27714 deleted from control-structures.for by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Dec 2009 16:08:56 +0000 |
| Subject: | note 27714 deleted from control-structures.for by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163664@lists.php.net to get a copy of this message | ||
Note Submitter: thewhiteness at hotmail dot com
----
Regarding ben's note: The reason for this is that your first example uses neither the $i++ or
$i+= operators. It's like telling PHP to add nothing to it ($i+).
Another way to possibly speed a for loop would be this:
...
for (;condition;) {
// your statement/block here
}
...
This way, if you have a variable that is being updated in the body of the loop anyways, you can use
it, rather than specify a number of iterations.