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

From: Date: Sun, 13 May 2001 02:19:43 +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-52597@lists.php.net to get a copy of this message
How about a case-swtich? http://www.php.net/manual/en/control-structures.switch.php Ethan Schroeder ----- Original Message ----- From: "DRN" <donaldrnoble@NOSPAM.yahoo.com> To: <php-general@lists.php.net> Sent: Saturday, May 12, 2001 4:40 PM Subject: [PHP] check if a variable is in a number of states. > 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 (#52597) next »