array_intersect_key:根据键名计算数组的交集
程序员文章站
2022-05-24 10:25:01
...
arrayarray_intersect_key(array$array1,array$array2[,array$...]) 返回一个数组:该数组的键在每一个数组都存在 $arr1 = ['a'='abc','b'='bbb','c'='cbd'];$arr2 = ['a'='ccc','c'='aaa','e'='eee'];$arr = array_intersect_key($arr1, $arr2);echo 'pre';p
array array_intersect_key ( array $array1 , array $array2 [, array $ ... ] )
返回一个数组:该数组的键在每一个数组都存在
$arr1 = ['a'=>'abc','b'=>'bbb','c'=>'cbd']; $arr2 = ['a'=>'ccc','c'=>'aaa','e'=>'eee']; $arr = array_intersect_key($arr1, $arr2); echo ''; print_r($arr); result: Array ( [a] => abc [c] => cbd )