I have two arrays of arrays containing a country name and a corresponding analytical metric. I need to subtract them (based on the first sub array value, i.e. the country) to return a third array of the countries found only in the first and not in the second. Example input and output:
First Array:
Array
(
[0] => Array
(
[0] => Afghanistan
[1] => 1
)
[1] => Array
(
[0] => Albania
[1] => 1
)
)
Second Array:
Array
(
[0] => Array // not found in 1st array by country name
(
[0] => Australia
[1] => 2
)
[1] => Array
(
[0] => Albania
[1] => 2
)
)
Intended Output
Array
(
[0] => Array
(
[0] => Australia
[1] => 2
)
)
array_dif();
is returning no differences, despite there being many in my data sets. How can I go about creating this subtracted third array (in PHP)?