array_diff_key

It computes the difference of arrays using keys for comparison

Example

<?php
echo “<pre>”;
$array1 = array(‘JSP’  => 1, ‘PHP’  => 2, ‘ASP’  => 3);
$array2 = array(‘JAVA’ => 5, ‘VB’ => 6, ‘PHTML’ => 7);
print_r(array_diff_key($array1, $array2));
?>

Output

Array
(
[JSP] => 1
[PHP] => 2
[ASP] => 3
)

Share