IF statement help

From: Date: Fri, 28 Sep 2001 17:48:05 +0000
Subject: IF statement help
Groups: php.general 
Request: Send a blank email to php-general+get-69199@lists.php.net to get a copy of this message
Hi: I have a script with an IF statement that has to check for several control commands in a single comparison (see below). If any one of the control commands are present, I will call a function. If none of the commands are present, I will call a different function. My question is: Is there a way to accomplish the same thing without having this large of an IF statement comparison? if (($key=="control1") || ($key=="control2") || ($key=="control3") || ($key=="control4") || ($key=="control5") || ($key=="control6") || ($key=="control7") || ($key=="control8") || ($key=="control9")) { // do something; } else { // do somthing else; } Thanks, Chesley

« previous php.general (#69199) next »