note 9610 added to switch
| From: | nospam at please dot com | Date: | Tue, 14 Nov 2000 22:18:32 +0000 |
| Subject: | note 9610 added to switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7698@lists.php.net to get a copy of this message | ||
Just a trick I have picked up:
If you need to evaluate several variables to find the first one with an actual value, TRUE for
instance. You can do it this was.
There is probably a better way but it has worked out well for me.
switch (true) {
case (X != 1):
case (Y != 1):
default:
}
http://www.php.net/manual/control-structures.switch.php