Possible Duplicate:
Compare multiple values in PHP
I want to do something like this
if($abc="asdf","sdfg","dfgh") {
echo "Something";
}
What should I do? Do I have to use seperate rules with || ?
Possible Duplicate:
Compare multiple values in PHP
I want to do something like this
if($abc="asdf","sdfg","dfgh") {
echo "Something";
}
What should I do? Do I have to use seperate rules with || ?
You would use in_array() for such purposes:
if (in_array($abc, array('asdf', 'sdfdg', 'qweqe'))) {
// something
}
The third parameter of in_array() can be used to perform strict type checks between the needle and each item of the haystack, similar to ===.