I am creating an array of arrays in the following way:
$final_array = array();
for($i = 0; $i < count($elements); $i++) {
for($j = 0; $j < count($elements); $j++) {
if($i!=$j)
$final_array[] = array_intersect($elements[$i], $elements[$j]);
}
}
I am trying to find out the list of elements that occur in all the arrays inside the $final_array
variable. So I was wondering how to pass this to array_intersect
function. Can someone tell me how to construct args u开发者_如何学JAVAsing $final_array[0], $final_array[1], ... $final_array[end_value]
for array_intersect
? Or if there is a better approach for this, that would be great too.
I am looking for a way to construct the following:
array_intersect($final_array[0], $final_array[1], $final_array[2], ...)
Why do you need to do all of this work? Just use call_user_func_array
.
精彩评论