Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个数组:array("blue", "yellow")和array("blue", "green", "red", "purple")。是否有一个函数可以检查这两个数组是否至少有一个共同的元素值(“蓝色”)——只返回真或假。
array("blue", "yellow")
array("blue", "green", "red", "purple")
$array1 = array("blue", "yellow"); $array2 = array("blue", "green", "red"); return count(array_intersect($array1, $array2)) > 0;