Re: check if a variable is in a number of states.

From: Date: Sun, 13 May 2001 05:38:09 +0000
Subject: Re: check if a variable is in a number of states.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52611@lists.php.net to get a copy of this message
You could also try using a regular expression to get out whatever you need (if it's a string). Something like the following: preg_match_all("/[abc|def|ghi]/",$type, $matches); - Steve ""DRN"" <donaldrnoble@NOSPAM.yahoo.com> wrote in message news:9dkhdr$nog$1@toye.p.sourceforge.net... > 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 > ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#52611) next »