I usually make a Helper for this situation, and use it like this
function GetProperties(array $arrOfObjects, $objectName) {
$arrProperties = array();
foreach ($arrOfObjects as $obj) {
if ($obj->$objectName) {
$arrProperties[] = $obj->$objectName;
}
}
return $arrProperties;
}