function haveAGroup($type, array $groups) { if (is_array($groups) && count($groups) && isset($this->groups[$type])) { foreach ($groups as $groups_id) { foreach ($this->groups[$type] as $data) { if ($data['groups_id'] == $groups_id) { return true; } } } } return false; }