0

I have three arrays in PHP. Example structure of arrays is as given below. I want to check if id is present in first then value with that it should not be repeated in any other arrays. fo eg in arrays below record with id 200 is present in first array then it is again in third array so I want to remove c0 from third array there will be 9 such arrays. What will be dynamic way for it.

Array
(
    [a0] => Array
        (
             [id] => 100
             [Country] => some country
        )

    [a1] => Array
        (
            [id] => 200
            [Country] => some country

        )

)



Array
(
    [b0] => Array
        (
            [id] =>300
            [Country] => some country

        )

    [b1] => Array
        (
            [id] => 100
            [Country] => some country
            [city] => some city

        )

)



Array
(
    [c0] => Array
        (
            [id] =>200
            [Country] => some country
            [state] => some state

        )

    [c1] => Array
        (
            [id] => 400
            [Country] => some country

        )

)
hrishi
  • 1,610
  • 6
  • 26
  • 43
  • In that question there is only one array with exact matching inner arrays – hrishi Nov 21 '16 at 11:12
  • Your question is not clear enough – Ukor Nov 21 '16 at 11:12
  • Just lookup `array_merge()` and you can combine them into one array and then `array_map()` to learn how to process them – mike510a Nov 21 '16 at 11:18
  • Ukor. I have arrays like above . And there should be only one record with on id. in above eg. id 100 is in first and third array so I want to remove c0 same id 200 is in first and second so I want to remove b1 from second array like that – hrishi Nov 21 '16 at 11:19
  • check this one http://stackoverflow.com/questions/4585208/how-can-you-make-a-multidimensional-array-unique – mike510a Nov 21 '16 at 11:20

0 Answers0