There are two arrays, the first is:

[0]=> { ["AAA"]=>"123" ["BBB"]=>"11" } [1]=> { ["AAA"]=>"321" ["BBB"]=>"13" } 

The second array looks like this:

 [0]=> { ["aaa"]=>"123" } [1]=> { ["aaa"]=>"111" } 

It is necessary to compare ["AAA"] and ["aaa"], if in the second array there is no value from the first, then write ["AAA"] and ["BBB"] to the new array.

  • modx? pdo? different nesting? - vp_arth
  • and what is written in ["BBB"] in a new array? - Ipatiev
  • @Ipatiev spelled the same structure of elements as in the first array - alexsoin
  • @vp_arth d me even on pure php at least do it - alexsoin

1 answer 1

For this task, the function array_diff_key(); as a result we get:

 $arr_new = array_diff_key($arr_one, $arr_two); 

As a result, the array $arr_new written [1]=> { ["AAA"]=>"321" ["BBB"]=>"13" }