I have the following array:
Array
(
[0] => Array
(
[0] => 87
[1] => 58
[2] => 85
[3]
This works for me:
function multi_intersect($arr) {
$return = array();
foreach ($arr as $a) {
foreach ($arr as $b) {
if ($a === $b) continue;
$return = array_merge($return, array_intersect($a, $b));
}
}
return array_unique($return);
}
Should get you:
Array
(
[0] => 58
)
The above will work if you have a common number in at least two of the sub-arrays.
After your edit:
You can simply use call_user_func_array on array_intersect, if you want to find numbers that are contained in all sub-arrays:
$intersect = call_user_func_array('array_intersect', $arr);