Here is a way to use array_intersect on array keys rather than
values:
<?php
$a = array("apple" =>
"red", "banana" => "yellow");
$z =
array("apple" => "green", "peach" =>
"orange", "banana" =>
"rotten");
$intersected_keys =
array_intersect(array_keys($a),
array_keys($z));
print_r($intersected_keys);
?>
This
will print:
Array ( [0] => apple [1] => banana )