array_intersect

Syntax:array array_intersect ( array $array1 , array $array2 [, array $ ... ] )
Description:Computes the intersection of arrays

<?php
$array1 = array("a" => "green", "red", "blue","yellow");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>
    
OUTPUT

Array ( 
[a] => green 
[0] => red 
[2] => yellow 
)