title: Sort PHP multi-dimensional array based on value in inner array?
body: <p>I'm trying to sort my PHP hashtable based on a specific value in the inner array.  The data structure looks like this:</p>
  
  <pre><code>print_r($mydata);
  
  Array(
  [0] =&gt; Array
      (
          [type] =&gt; suite
          [name] =&gt; A-Name
      )
  [1] =&gt; Array
      (
          [type] =&gt; suite
          [name] =&gt; C-Name
      )
  [2] =&gt; Array
      (
          [type] =&gt; suite
          [name] =&gt; B-Name
      )
  )
  </code></pre>
  
  <p>I've tried <strong>ksort</strong>, <strong>sort</strong>, <strong>usort</strong> but nothing seems to work.  I'm trying to sort based on the <strong>name key</strong> two-levels down.</p>
  
  <p>This was my attempt using usort:</p>
  
  <pre><code>function cmp($a, $b) {
      return $b['name'] - $a['name'];
  }
  
  usort($mydata, "cmp");
  </code></pre>
  
  <p>Is there an easy way to do this or do I need to write a custom sort function?</p>