array_intersect_assoc : array_intersect « Data Structure « PHP






array_intersect_assoc

 
<?php

$array1 = array("OH" => "Ohio", "CA" => "California", "HI" => "Hawaii");
$array2 = array("50" => "Hawaii", "CA" => "California", "OH" => "Ohio");
$array3 = array("TX" => "Texas", "MD" => "Maryland", "OH" => "Ohio");
$intersection = array_intersect_assoc($array1, $array2, $array3);
print_r($intersection);

?>
  
  








Related examples in the same category

1.Array Intersection
2.array_intersect
3.array_intersect( ) function returns a new array containing all the values of array $arr1 that exist in array $arr2.
4.Intersecting two arrays that have no duplicate keys, all the keys will be retained.