1function in_array_any($needles, $haystack) {
2 return !empty(array_intersect($needles, $haystack));
3}
4
5echo in_array_any( [3,9], [5,8,3,1,2] ); // true, since 3 is present
6echo in_array_any( [4,9], [5,8,3,1,2] ); // false, neither 4 nor 9 is present
7
1$haystack = array(...);
2
3$target = array('foo', 'bar');
4
5if(count(array_intersect($haystack, $target)) == count($target)){
6 // all of $target is in $haystack
7}
8
9if(count(array_intersect($haystack, $target)) > 0){
10 // at least one of $target is in $haystack
11}