Currently going crazy on how to do this, basicly I have a multidimensional array and need a code to check all values and if value exists in all arrays than to return the result.
Parents visitPoints,islands,animals will always exist, although some times empty, the second level columns are dynamic so keys 20,35,57 change and there content.
$array = [
'visitPoints'=>[
20=>[2,5,6,8,10,11],
35=>[2,5,6],
57=>[1],
],
'islands'=>[
20=>[5,10,11],
35=>[5,6]
],
'animals'=>[
20=>[5,11],
35=>[]
]
];
And the result I'm looking for is this:
$result = [
20=>[5,11],
35=>[],
57=>[]
];
was playing around with call_user_func_array('array_intersect', $array) but could not get the result I'm looking for.
Here is the sample link: https://3v4l.org/meX5p