$a = 'red';
$b = 'blue';
$colors = ['red', 'green', 'blue', 'black'];
I am trying to check if both $a, and $b are present in $colors
If yes, return true else return false
I could obviously do
if(in_array($a, $colors) && in_array($b, $colors)){
//true
}
But, I am hoping for an array function that can do both in on call, or any method simpler than that. I tried with array_intersect() to no avail.
array_intersect()?