I have an array of objects. The objects have a is_valid
method that has some internal logic and returns either a boolean.
Now I want to get all objects in the array that return true to is_valid
. I can do it using a foreach
loop.
But is there way to do it using array_filter
in PHP without creating a new anonymous or callback function?