How to sort results in PHP? : <pre><code>     foreach($domainCheckResults as $domainCheckResult)
    {
        switch($domainCheckResult-&gt;status)
        {
            case Transip_DomainService::AVAILABILITY_INYOURACCOUNT:
                $result .= "&lt;p style='color:red;'&gt;".$domainCheckResult-&gt;domainName."&lt;/p&gt;";
            break;

            case Transip_DomainService::AVAILABILITY_UNAVAILABLE:
                $result .= "&lt;p style='color:red;'&gt;".$domainCheckResult-&gt;domainName."&lt;/p&gt;";
            break;

            case Transip_DomainService::AVAILABILITY_FREE:
                $result .= "&lt;p style='color:#1aff1a;'&gt;".$domainCheckResult-&gt;domainName."   "."&lt;a href='ticket.php'&gt;&lt;img src='img/next.png' alt='house'                                                      width='20' height='20' align='right' title='domein aanvragen?'&gt;&lt;/a&gt;"."&lt;/p&gt;";
            break;

            case Transip_DomainService::AVAILABILITY_NOTFREE:
                $result .= "&lt;p style='color:#ff9933;'&gt;".$domainCheckResult-&gt;domainName."   "."&lt;a href='contactform.php'&gt;&lt;img src='img/65.png' alt='house'                                          width='20' height='20' align='right' title='domein laten verhuizen?'&gt;&lt;/a&gt;"."&lt;/p&gt;";
            break;
        }
    }
</code></pre>

<p>So I have 4 possible results for domain availability. I have a array with 20 domains and when I get the results I get them in the sorting of my array. But How can I sort is on availability, so the once that are free all at the top and the once that are not free for whatever reason down? What can I use? I used the sort() tag but that won`t help.</p>
