array_intersect

It finds the intersection of arrays

Example

<?php
echo “<pre>”;
$array1 = array(“a” => “PHP”, “ASP”, “JSP”);
$array2 = array(“b” => “PHP”, “ASP”, “JSP”);
$array3 = array_intersect($array1, $array2);
print_r($array3);
?>

Output

Array
(
[a] => PHP
[0] => ASP
[1] => JSP
)


Share