How to load terms in alphabetical order or in the same order they are in CMS? I am loading terms programmatically but I am hoping to load them in the same order as they show in the CMS (weight). If not that, I just want them to load in alphabetical order.

This is what I am doing:

$vocabulary = taxonomy_vocabulary_machine_name_load($name);
$terms = entity_load('taxonomy_term', FALSE, array('vid' =&gt; $vocabulary-&gt;vid));


Any idea how to achieve that?
For getting all child terms in a vocabulary try the following code.

$cc=array();
$tax=taxonomy_vocabulary_machine_name_load($name);
$vid= $tax-&gt;vid;
$child_terms = taxonomy_get_tree($vid);
foreach($child_terms as $values) {
  $tname=$values-&gt;name;
  $cc[] = $tname; 
}


The above code will give you child terms of that vocabulary in array $cc. For sorting in alphabetical order use asort($cc);

Hope this will help you.