有没有办法让在PHP两个阵列之间共同的价值观?
问题描述:
是否有这样做内部的PHP两个阵列之间加入的可能性?例如:
Is there a possibility of doing inner join between two arrays in php? for example
如果我有两个数组数组1,数组2
if i have two arrays array1,array2
输入:
array1[0]['id']=1 , array1[1]['id']=2 , array1[2]['id']=3
array2[0]['id']=3 , array2[1]['id']=4 , array2[2]['id']=5
输出:
array2[0]['id']=3;
是可以与任何内置函数获取共同的价值观?
is it possible to retrieve common values with any inbuilt functions?
谢谢,
巴兰
答
array_intersect()
功能可能是你正在寻找一个; - )
The array_intersect()
function might be the one you are looking for ;-)