note 27991 added to control-structures.switch
| From: | Clouds at rack1 dot php dot net | Date: | Sat, 28 Dec 2002 21:31:58 +0000 |
| Subject: | note 27991 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41395@lists.php.net to get a copy of this message | ||
To avoid wrong results each (list of) statements should be ended with a break-statement.
So this will give the result you need:
switch (TRUE) {
case not TRUE: // not TRUE
case not TRUE: // not TRUE
case TRUE:
do_statement_1;
do_statement_2;
do_statement_n;
break; // iyou should add this!
case not TRUE: // NOT TRUE -- Do nothing
case not TRUE: // NOT TRUE -- Do nothing
}
Also see above the section about how a switch-statement works.
--
http://www.php.net/manual/en/control-structures.switch.php
http://master.php.net/manage/user-notes.php?action=edit+27991
http://master.php.net/manage/user-notes.php?action=delete+27991
http://master.php.net/manage/user-notes.php?action=reject+27991