printing out an array alphabetically
<p>hi i have the following code from a template. </p>

<pre><code>&lt;ul class="sub-categories"&gt;
    &lt;?php

        foreach ($category-&gt;getChildren() as $child) {
            if (!$child-&gt;totalItemCount()) continue;
            $link = $this-&gt;app-&gt;route-&gt;category($child);
            $item_count = ($this-&gt;params-&gt;get('template.show_sub_categories_item_count')) ? ' &lt;span&gt;('.$child-&gt;totalItemCount().')&lt;/span&gt;' : '';
            echo '&lt;li&gt;&lt;a href="'.$link.'" title="'.$child-&gt;name.'"&gt;'.$child-&gt;name.'&lt;/a&gt;'.$item_count.'&lt;/li&gt;';
        }

    ?&gt;
&lt;/ul&gt;
</code></pre>

<p>I would like to sort the sub category items (which are cities subdivided by state further up in the code.</p>

<p>i thought i could just sort the following array $category->getChildren() but it doesnt work. so i did an echo on it and it said array, so i did var_dump on that array and got a bool(true) on it. when i tried other ways (print_r) of outputting it it crashed the page.</p>

<p>i dont understand arrays very well so could someone explain what is this array that is not an array?  how can i sort the city list?</p>

<p>thanks!</p>
