Possible Duplicate:
PHP make if shorter
I have an if
statement that looks like this:
if($variable == "one" || $variable == "two" || $variable == "three" || $variable == "four"){
// do something
}
else {
// do something else
}
the problem is that its getting quite hefty.. its going to be about 20 or 30 different options.
Is there anyway I can do this in less code? EG:
if($variable == ("one" || "two" || "three" || "four" || "five"))..