# Searching the array for multiple values corresponds to the set operations (set difference and intersection), as you will see below.
# In your question, you do not specify which type of array search you want, so I am giving you both options.
# ALL needles exist
function in_array_all($needles, $haystack) {
return empty(array_diff($needles, $haystack));
}
$animals = ["bear", "tiger", "zebra"];
echo in_array_all(["bear", "zebra"], $animals);
echo in_array_all(["bear", "toaster"], $animals);
# ANY of the needles exist
function in_array_any($needles, $haystack) {
return !empty(array_intersect($needles, $haystack));
}
$animals = ["bear", "tiger", "zebra"];
echo in_array_any(["toaster", "tiger"], $animals);
echo in_array_any(["toaster", "brush"], $animals);
# Important consideration
$animals = ZooAPI.getAllAnimals();
$all = in_array("tiger", $animals) && in_array("toaster", $animals) && ...
$any = in_array("bear", $animals) || in_array("zebra", $animals) || ...