I have the following array. How would I delete (unset) all elements in it for the following two scenarios?
- Delete all elements where prop is equal to "a". Should delete element 0 and 2.
- Delete all elements where prop is in array("a","d"). Should delete elements 0, 2, and 3.
I can obviously iterate over the array, and check if there is a match, but I expect there is a more efficient way to do so.
Array
(
[0] => obj Object
(
[prop] => a
)
[1] => obj Object
(
[prop] => b
)
[2] => obj Object
(
[prop] => a
)
[3] => obj Object
(
[prop] => d
)
)