note 27566 deleted from control-structures.switch by didou
| From: | didou@php.net | Date: | Sun, 07 Dec 2003 03:06:07 +0000 |
| Subject: | note 27566 deleted from control-structures.switch by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61568@lists.php.net to get a copy of this message | ||
Note Submitter: njones at fredesign dot com
----
Running: PHP4.03pl1 - Linux - Apache
I'm not sure if this is how the switch is suppose to work? But when you are evaluating a (TRUE
or FALSE) for the switch while doing a long series of checks (so you have no "break;"
statements) you may run into the problem that once the switch has hit the value you have set, it
will not evaluate the following case statements correctly.
so...
switch (TRUE) {
case not TRUE: // not TRUE
case not TRUE: // not TRUE
case TRUE: // TRUE -- Do Statement
case not TRUE: // TRUE -- Do Statement
case not TRUE: // TRUE -- Do Statement
...
}
What I ended up doing is splitting my switch condition in logical areas to reset when I knew that
there could be a TRUE trigger.