I'm trying to handle this data that I'm getting dynamically from an API. I know that the id
's will always be unique, but the name
's often match each other, which is a problem. Using PHP, how would I remove any stdClass Object whose name
is identical to a previous object's name
value from this array? I do specifically want the checks to progress from 0 to the highest value because there is other data in these stdClass Objects. In this case, I would want 1
to be removed because its name matches 0
's name, but afterwards what is currently 2
should become the new 1
for obvious reasons.
Array
(
[0] => stdClass Object
(
[id] => 6969
[name] => Steve Jobs
)
[1] => stdClass Object
(
[id] => 2013
[name] => Steve Jobs
)
[2] => stdClass Object
(
[id] => 1234
[name] => The Woz
)
)
Thanks!