title: PHP reverse sorting sub array by keys
body: <p>Hey guys I'm trying to reverse sort a multidimensional array with usort but am messing up somewhere. Here's my code:</p>
  
  <pre><code>$array = array(
      array(123 =&gt; 'foo'), // duplicate
      array(124 =&gt; 'foo'),
      array(127 =&gt; 'foo'),
      array(126 =&gt; 'foo'),
      array(123 =&gt; 'foo'), // duplicate
      array(125 =&gt; 'foo'),
  );
  
  function rcmp($a, $b) {
      if($a == $b) {
          return 0;
      }
      return ($a &lt; $b) ? -1 : 1;
  }
  
  usort($array, 'rcmp');
  
  print_r($array);
  
  /*
      Array
      (
          [0] =&gt; Array ( [126] =&gt; foo) )
          [1] =&gt; Array ( [125] =&gt; foo) )
          [2] =&gt; Array ( [127] =&gt; foo) )
          [3] =&gt; Array ( [123] =&gt; foo) )
          [4] =&gt; Array ( [124] =&gt; foo) )
          [5] =&gt; Array ( [123] =&gt; foo) )
      )
  */
  </code></pre>
  
  <p>I am expecting </p>
  
  <pre><code>/*
      Array
      (
          [0] =&gt; Array ( [127] =&gt; foo) )
          [1] =&gt; Array ( [126] =&gt; foo) )
          [2] =&gt; Array ( [125] =&gt; foo) )
          [3] =&gt; Array ( [124] =&gt; foo) )
          [4] =&gt; Array ( [123] =&gt; foo) )
          [5] =&gt; Array ( [123] =&gt; foo) )
      )
  */
  </code></pre>
  
  <p>What am I doing wrong?</p>