- array_intersect_key: documentation ( source)
- array_shift: documentation ( source)
<?php
function getParent($child=null)
{
//mock:
return array(
(object)(array('user'=>'foo', 'data'=>'fee')),
(object)(array('user'=>'far', 'data'=>'bee')),
);
};
$result = array_shift(array_intersect_key(getParent('baz'), array(null)))->user;