I frequently find myself writing things like if($var == 'bob' || $var == 'steven || $var == 'james'){ ...
Is there a slicker way in php to check whether a var matches any operator? Or do I have to write my own function like:
function matches_any($question, $pos_answer, $pos_answer, $pos_answer, $pos_answer, ...){
// Call the function args, get the first one, get the rest, compare all the rest, return true if any match, return false by default.
}
Which would be used thus:
if(matches_any($var, $bob, $steven, 'james', $william)){ ...
You can use
in_array()