I have an array of objects. Each object in the array has the property recipeID
. I'm looking to delete an object if its recipeID
property matches another object's recipeID
property.
Basically, I would like to perform a array_unique()
on the array of objects but using the $object->recipeID
as criterion that is being checked against.
For example, why wouldn't this work?
array_unique($objectArray);
If the recipeID
property in two objects were the same, wouldn't that make those two objects equal? Assuming there were no other properties. Then array_unique()
would see a multiple and delete one of them.