I have an array like this. What I am trying to do is remove duplicate entries. I want to compare values of array with different keys.
For example, the first 2 elements in array has key areacode. 3 & 4 has key state.
I want to compare the values of areacode and state and remove the duplicate entries. That is, 0 and 2 have state/areacode =>'US', so I want to remove one of these.
How should I do it?
Array (
[0] => stdClass Object
(
[areacode] => US
[id] => 7-CxFsXZBGGCiYlW-NYKFw
[city] => San Francisco
)
[1] => stdClass Object
(
[areacode] => CL
[id] => 7-CxFsXZBGGCiYlW-NYKFw
[city] => San Francisco
)
[2]=>stdClass Object
(
[state] => US
[id] => 7-CxFsXZBGGCiYlW-NYKFw
[city] => San Francisco
)
[3]=>stdClass Object
(
[state] => SA
[id] => 7-CxFsXZBGGCiYlW-NYKFw
[city] => San Francisco
)
)