I have an array of objects. I need to loop over these objects (preferably without foreach()
, and if a certain key in the objects is not empty, then return true, otherwise return false.
For example,
$items = array(
'0' => stdClass {
name => Ryan
suppliers => array()
}
'1' => stdClass {
name => Dave
suppliers => array(
'0' => stdClass {}
)
}
)
Essentially, I need to go through the array and check the "supplier" key of the object, and if any of them are not empty, return true for the entire thing, otherwise return false.