note 27991 deleted from control-structures.switch by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Sat, 28 Dec 2002 23:25:26 +0000 |
| Subject: | note 27991 deleted from control-structures.switch by jmcastagnetto | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-41398@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.