comparing multidimensional array

Posted by John K on Stack Overflow See other posts from Stack Overflow or by John K
Published on 2011-01-16T06:37:43Z Indexed on 2011/01/16 6:53 UTC
Read the original article Hit count: 183

Filed under:
|
|

Hello everyone,

I have the following array:

Array
(
    [0] => Array
        (
            [0] => 87
            [1] => 55
            [2] => 85
            [3] => 86
        )

    [1] => Array
        (
            [0] => 58
            [1] => 84
        )

    [2] => Array
        (
            [0] => 58
        )

)

This array above is an example. The actual array is of variable size, but structured like this. Basically, I'd like to run array_intersect on each second level array and grab the value (number) that is common between them. In this case, it would be 58.

I'm not quite sure where to start on this. Any advice?

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays