Skip to content

Instantly share code, notes, and snippets.

public static function getSubTopicIdsOfTopic($topicId, $topics)
{
$list = array();
foreach ($topics as $key => $topic) {
if ($topic->parentId == $topicId) {
$list[] = $topic->id;
$list = array_merge($list, self::getSubTopicIdsOfTopic($topic->id, $topics));
}
}
return $list;