note 23281 added to control-structures.for
| From: | admira666 at hotmail dot com | Date: | Sun, 14 Jul 2002 03:50:34 +0000 |
| Subject: | note 23281 added to control-structures.for | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33043@lists.php.net to get a copy of this message | ||
Another tip about 'For Loops' inherent of C/C++
If the loop is only executing a single statement (which can happen from time to time) the opening
and closing brackets may be omitted.
Example:
for ($i=0; $i<10; $i++)
execute_this_statement;
Is the same as:
for ($i=0; $i<10; $i++) {
execute_this_statement;
}
Not an impressive feature, but it involves less typing and cleans up the code a bit.
This also works with 'If...Else' statements too.
--
http://www.php.net/manual/en/control-structures.for.php
http://master.php.net/manage/user-notes.php?action=edit+23281
http://master.php.net/manage/user-notes.php?action=delete+23281
http://master.php.net/manage/user-notes.php?action=reject+23281