I need to find common values in multiple arrays. Number of arrays may be infinite.
Example (output from print_r
)
Array1
(
[0] => 118
array_intersect()
$intersect = array_intersect($array1,$array2,$array3);
If you don't know how many arrays you have, then build up an array of arrays and user call_user_func_array()
$list = array();
$list[] = $array1;
$list[] = $array2;
$list[] = $array3;
$intersect = call_user_func_array('array_intersect',$list);