I have a multidimensional array which outputs data as such (this gets filled with a foreach looping over specific items):
Array
(
[1] => Array
(
[0] => 0
)
[3] => Array
(
[0] => 0
[1] => 1
[2] => 2
)
[9] => Array
(
[0] => 2
)
)
The first keys are id's of specific items, the keys on the second level are of no meaning/importance, the values however are.
As you can see in this example, the value 0
exists both in 1
and 3
, and the value 2
existst in both 3
and 9
and only 1
is unique. What I'd like to achieve here is to check if any value exists within multiple items (as is here the case) and have some way of keeping track where certain values are duplicated.
How would I go about doing this? I've tried implementing multiple solutions, including the ones found here, but whatever I try, it doesn't quite seem to work the way I'd like it to.
Many thanks to whoever can help me out or point me in the right direction.