Answers for "check with multiple values in array php"

PHP
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
}
Posted by: Guest on May-26-2020
0

multiple value match in array php

if (in_array('a', $array_under_test) || in_array('b', $array_under_test)) {
  // Success!
}
Posted by: Guest on September-25-2020

Code answers related to "check with multiple values in array php"

Browse Popular Code Answers by Language