In writing select statements in mySQL, if I want to pull records where a column value equals one of a number of values, I can say something like this:
SELECT * FROM myTable WHERE myColumn IN(1,5,7)
Is the only way to accomplish something similar in PHP with OR?
if($category == 1 || $category == 5 || $category == 7) {
// do something
}
See the
in_array()function.E.g.:
Or, more compactly: