Skip to content

Instantly share code, notes, and snippets.

@ferower
Created November 30, 2011 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ferower/1408279 to your computer and use it in GitHub Desktop.
Save ferower/1408279 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment