php检查一个数组与另一个数组的所有匹配项
我有两个列有人的数组,我试图找出两个数组中都有哪些人php检查一个数组与另一个数组的所有匹配项,php,arrays,Php,Arrays,我有两个列有人的数组,我试图找出两个数组中都有哪些人 $employees = Array("bob", "john", "jerry", "mike"); $homies = Array("bob", "john", "arnold"); 我基本上需要知道哪些人既是员工又是同事(在本例中是bob和john),这样我就有了一个新的阵列: $employees_and_homies = Array("bob", "john"); 我在这里看了十几个问题,但我迷路了,这件案子什么都没用 : @参
$employees = Array("bob", "john", "jerry", "mike");
$homies = Array("bob", "john", "arnold");
我基本上需要知道哪些人既是员工又是同事(在本例中是bob和john),这样我就有了一个新的阵列:
$employees_and_homies = Array("bob", "john");
我在这里看了十几个问题,但我迷路了,这件案子什么都没用 :
@参考:
$employees_and_homies = array_intersect($employees, $homies);
print_r(array_intersect ($employees, $homies));