0

I have values to check like this

Array
(
[0] => test
[1] => word
[2] => section
[3] => etc
 )

And array that needs to be check like this

 Array
 (
[0] => divide
[1] => word
[2] => Array
    (
        [1] => test
        [2] => other
    )
[3] => test
)

So, I need to loop throw second array and check is there some of the values from first array (on place where I have multidimensional array, second value that does not match can stay). I tried all sorts of combinations of array intersect, looping etc, but I just can not figure out what would be proper way to do this. Can anybody point me in right direction?

Desired output would be:

 Array
 (
   [0] => test
   [1] => word
 )

or

 Array
 (
   [0] => test
   [1] => word
   [2] => Array
   (
      [1] => test
      [2] => other
   )
 )
codexy
  • 413
  • 1
  • 5
  • 18

0 Answers0