The array_intersect() function used for compares the values of two or more arrays, and returns common elements.
Syntax
array_intersect(array1,array2,array3...);
Example
$array1 = array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
$array2 = array("a"=>"red","b"=>"green","c"=>"blue");
print_r(array_intersect($array1,$array2));
Output
Array ( [a] => red [b] => green [c] => blue )
Copyright ©2022 coderraj.com. All Rights Reserved.