Skip to content

Instantly share code, notes, and snippets.

@otarza
Created October 1, 2013 14:36
Show Gist options
  • Save otarza/6779498 to your computer and use it in GitHub Desktop.
Save otarza/6779498 to your computer and use it in GitHub Desktop.
$ordered_terms = array();
foreach ($terms as $term) {
if ($term->parents[0] == 0) {
$ordered_terms[$term->tid] = $term;
} else {
$ordered_terms[$term->tid]['children'][] = $term;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment