multiple values in array php code example
Example 1: in array php multiple values
$haystack = array(...);
$target = array('foo', 'bar');
if(count(array_intersect($haystack, $target)) == count($target)){
// all of $target is in $haystack
}
if(count(array_intersect($haystack, $target)) > 0){
// at least one of $target is in $haystack
}
Example 2: multiple value match in array php
if (in_array('a', $array_under_test) || in_array('b', $array_under_test)) {
// Success!
}