If I understand you correctly, this is probably what you want.
<?PHP
$a = array(array(1, 2, 3, 4, 5, 6, 7, 8, 9),
array(1, 2, 3, 4, 5,),
array(1, 3, 4, 5, 7),
array(1, 4, 5));
$intersect = array_map("cumulative_intersect", $a);
print_r(cumulative_intersect());
function cumulative_intersect($in = null) {
static $accumulator = array();
if (is_null($in)) {
return($accumulator);
}
if (sizeof($accumulator) == 0) {
$accumulator = $in;
}
$accumulator = array_intersect($accumulator, $in);
return($accumulator);
}
?>
Returns:
Array
(
[0] => 1
[3] => 4
[4] => 5
)