Sorting a table with foreach?
<p>Not sure if this is possible, but I'd like to sort a foreach table by a column, highest to lowest. The last column has a <code>count</code> formula to calculate <code>PilotData::getAllPilotsByHub</code> and I'd like the row with the highest number to be always first in the table.</p>

<pre><code>&lt;?php 
$allhubs = OperationsData::GetAllHubs();

foreach($allhubs as $hub)
{
?&gt;
&lt;tr&gt;
    &lt;td align="center"&gt;&lt;?php echo $hub-&gt;icao; ?&gt;&lt;/td&gt;
    &lt;td align="center"&gt;&lt;?php echo $hub-&gt;name; ?&gt;&lt;/td&gt;
    &lt;td align="center"&gt;&lt;?php echo count(PilotData::getAllPilotsByHub(''.$hub-&gt;icao.'')); ?&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;?php
}
?&gt;
</code></pre>
