I wrote a simple function to perform an intersect on multiple (unlimited) arrays.
Pass an array containing all the arrays you want to compare, along with what key to match by.
<?php
function multipleArrayIntersect($arrayOfArrays, $matchKey)
{
$compareArray = array_pop($arrayOfArrays);
foreach($compareArray AS $key => $valueArray){
foreach($arrayOfArrays AS $subArray => $contents){
if (!in_array($compareArray[$key][$matchKey], $contents)){
unset($compareArray[$key]);
}
}
}
return $compareArray;
}
?>