note 27714 added to control-structures.for
| From: | thewhiteness at hotmail dot com | Date: | Mon, 16 Dec 2002 20:10:05 +0000 |
| Subject: | note 27714 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40978@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/control-structures.for.php
http://master.php.net/manage/user-notes.php?action=edit+27714
http://master.php.net/manage/user-notes.php?action=delete+27714
http://master.php.net/manage/user-notes.php?action=reject+27714