title: How to sort PHP multidimensional associative array with a selected key value
body: <p>How to sort following php array with its 'zindex' key value</p>
  
  <pre><code>$array = array('the-1'=&gt; array('name'=&gt;'lorem','pos'=&gt;array('top'=&gt;'90','left'=&gt;'80'),'zindex'=&gt;2),
          'the-2'=&gt; array('name'=&gt;'ipsum','pos'=&gt;array('top'=&gt;'190','left'=&gt;'180'),'zindex'=&gt;1),
          'the-3'=&gt; array('name'=&gt;'lorem ipsum','pos'=&gt;array('top'=&gt;'20','left'=&gt;'30'),'zindex'=&gt;3)
          )
  </code></pre>
  
  <p>Is there any php function for getting the output as follows,</p>
  
  <pre><code>$array = array(
          'the-2'=&gt; array('name'=&gt;'ipsum','pos'=&gt;array('top'=&gt;'190','left'=&gt;'180'),'zindex'=&gt;1),
          'the-1'=&gt; array('name'=&gt;'lorem','pos'=&gt;array('top'=&gt;'90','left'=&gt;'80'),'zindex'=&gt;2),
          'the-3'=&gt; array('name'=&gt;'lorem ipsum','pos'=&gt;array('top'=&gt;'20','left'=&gt;'30'),'zindex'=&gt;3)
          )
  </code></pre>