title: PHP: descending asort doesn't work?
body: <p>I have this website using arrays and then I have this function which sorts these arrays using <code>asort</code>. It looks like this:</p>
  
  <pre><code>function aasort (&amp;$array, $key) {
      $sorter=array();
      $ret=array();
      reset($array);
      foreach ($array as $ii =&gt; $va) {
          $sorter[$ii]=$va[$key];
      }
      asort($sorter);
      foreach ($sorter as $ii =&gt; $va) {
          $ret[$ii]=$array[$ii];
      }
      $array=$ret;
  }
  </code></pre>
  
  <p>This algorithm sorts the array from 1-10 but I'll need it to sort descending, from 10-1. I have tried using <code>rsort</code> with no luck, and I have tried <code>array_reverse</code> too without luck. I don't know if I have used them wrong? Or.. Well at least I just need the algorithm to sort them descending. Any idea, advice or suggestions are appreciated. Thanks!</p>