array_intersect_assoc

It finds the intersection of arrays with additional index check

Example

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

Output

Array
(
[a] => PHP
)

Share