I am trying to accomplish this without nested loops. I have the following 2 arrays:
$arr1 = array(
0 => array(
"key" => 1,
"value" => "Test 1"
),
1 => array(
"key" => 35
"value" => "Test 2"
)
...
);
$arr2 = array(
0 => array(
"key" => 1,
"value" => "Test 1"
)
...
);
print_r(array_diff_magic($arr1, $arr2));
Returns all items in array 1 that was removed from array 2 but by comparing the "key" values of sub arrays. Can not use array_diff_keys because need to compare sub array's "keys" instead of the keys of the main array. The output should be something like this:
array(1) {
[0] => array(2) {
["key"] => 35,
["value"] => "Test 2"
}
}
Is there a way to do this without using nested foreach loops?