I have an array comprised of PHP objects as such:
$objects[0] => $object->type => 'President'
$object->name => 'Joe Blogs'
$object->address => '123 Harry Street'
$objects[1] => $object->type => 'Secretary'
$object->name => 'Joe Blogs'
$object->address => '123 Harry Street'
$objects[2] => $object->type => 'Treasurer'
$object->name => 'Jane Doe'
$object->address => '456 Upton Street'
I would like to ignore the type parameter and end up with:
$objects[0] => $object->type => 'President'
$object->name => 'Joe Blogs'
$object->address => '123 Harry Street'
$objects[2] => $object->type => 'Treasurer'
$object->name => 'Jane Doe'
$object->address => '456 Upton Street'
I have tried a few different things, one of which was to unset the parameter type using a foreach loop and then trying to reset it, but I wasn't sure how to tie the two indexes together to reset them. Another was trying to use the union in the select command but that wasn't working 100% correctly either.
I am just not sure how to best manage the type parameter.
EDIT:
I have tried to make the query a little easier, it now returns a list of IDs that I will get the address information later. This is the new array that I would like to filter out any duplicates.
$items['president'][0] = '1'
[1] = '2'
[2] = '3'
$items['secretary'][0] = '1'
[1] = '4'
[2] = '5'
What I would like is
$items['president'][0] = '1'
[1] = '2'
[2] = '3'
$items['secretary'][1] = '4'
[2] = '5'
Is that any better? (Note: I can use both array structures, but the second one would be better)