I have been racking my head trying to think if there is a simpler method to grabbing the unique objects out of an array, but can't find any documentation or confirmation that anything exists that will do what I am asking.
I have an API returning the following:
Array
(
[0] => stdClass Object
(
[Name] => Kory Kelly
[PhoneNumber] => (555) 555-5555
[EmailAddress] => kkelly@email.com
)
[1] => stdClass Object
(
[Name] => Kory Kelly
[PhoneNumber] => (555) 555-5555
[EmailAddress] => kkelly@email.com
)
)
Now obviously I cannot use array_unique -- Since it checks actual values against array keys -- I have built a recursive function to tear apart the objects, rebuild as an array and do the checks manually during rebuild IE
if ( $arr['Name'] === $passed_arr['Name']
&& $arr['PhoneNumber'] === $passed_arr['PhoneNumber']
&& $arr['EmailAddress'] === $passed_arr['EmailAddress'] )
And that works .. But it seems a little long winded. Is there a built-in / more efficient approach to this? I feel like I am re-inventing the wheel with my current aproach.