note 21741 added to control-structures.break
| From: | pavel_lishin at yahoo dot com | Date: | Fri, 24 May 2002 23:35:30 +0000 |
| Subject: | note 21741 added to control-structures.break | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31012@lists.php.net to get a copy of this message | ||
If you have several nested IF statements, you can break out of them using a little trick...
if (condition 1)
do {
if (condition 2) break;
} while (0)
The break breaks out of the while loop, but since the loop only runs once it also breaks out of the
"condition 1" if statement.
--
http://www.php.net/manual/en/control-structures.break.php
http://master.php.net/manage/user-notes.php?action=edit+21741
http://master.php.net/manage/user-notes.php?action=delete+21741
http://master.php.net/manage/user-notes.php?action=reject+21741