check if a variable is in a number of states.
| From: | DRN | Date: | Sat, 12 May 2001 23:40:11 +0000 |
| Subject: | check if a variable is in a number of states. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-52596@lists.php.net to get a copy of this message | ||
Hi, I would like to check whether a variable, $type, is equal to a
number of different possible states. I know I could use
if ( $type == "abc" || $type == "bcd") { $a = b }
but this would get a bit clumsy if I had to check whether it is say
one of 20 different things.
What I was wondering is, is there a better way of doing this? I will
occasionally need to add another option as well, although I don't mind
a simple code edit.
Cheers for your help, Donald
__________________________________________
As well as learning more,
I learn that there is even more I don't know
http://www.donaldrnoble.f2s.com
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯