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

2001-05-12 Thread Steve
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"" <[EMAIL PROTECTED]> wrote in message 9dkhdr$nog$[EMAIL PROTECTED]">news:9dkhdr$nog$[EMAIL PROTECTED]..

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

2001-05-12 Thread Philip Olson
Here's an appropriate example, one of a few ways you may do it : $state = 'Wa'; $state = trim(strtoupper($state)); $states = array('WA' => 'Washington', 'OR' => 'Oregon', 'ID' => 'Idaho'); if (in_array($state, array_keys($states))) { echo "you chose {$states[$state]}, a state in

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

2001-05-12 Thread Ethan Schroeder
How about a case-swtich? http://www.php.net/manual/en/control-structures.switch.php Ethan Schroeder - Original Message - From: "DRN" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, May 12, 2001 4:40 PM Subject: [PHP] check if a variable is in a number of states. > Hi, I woul