foreach(self::getGroups() as $group) $group_ids[] = $group->getId();
Is there a better, cleaner and more efficient way to do that?
Thanks! :-)
foreach(self::getGroups() as $group) $group_ids[] = $group->getId();
Is there a better, cleaner and more efficient way to do that?
Thanks! :-)
Well the only other way of doing that is with array_map()
and it's not necessarily any quicker or better:
function get_id($group) {
return $group->getId();
}
$group_ids = array_map('get_id', self::getGroups());