I have an array of Objects that have a member name
.
How can I find the first object which fulfills the condition
Object->name == "foo"
In practice, is there a faster way than:
$needle = null;
foreach($myarray as $myobject)
{
if($myobject->name == "foo")
{
$needle = $myobject;
break;
}
}