array_intersect : array_intersect « Data Structure « PHP






array_intersect

 
<?php

$array1 = array("OH","CA","NY","HI","CT");
$array2 = array("OH","CA","HI","NY","IA");
$array3 = array("TX","MD","NE","OH","HI");
$intersection = array_intersect($array1, $array2, $array3);
print_r($intersection);

?>
  
  








Related examples in the same category

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