title: Sorting multi-dimensional associative array in PHP
body: <p>I have a PHP array that looks like this:</p>
  
  <pre><code>array (size=1)
    'Marriot' =&gt; 
      array (size=7)
        0 =&gt; string 'doc5.txt' (length=8)
        1 =&gt; string 'test.txt' (length=8)
        2 =&gt; string 'test1.txt' (length=9)
        3 =&gt; string 'test2.txt' (length=9)
        4 =&gt; string 'test3.txt' (length=9)
        5 =&gt; 
          array (size=1)
            'Special Docs' =&gt; 
              array (size=2)
                0 =&gt; string 'doc4.txt' (length=8)
                1 =&gt; string 'doc3.txt' (length=8)
        6 =&gt; 
          array (size=1)
            'ADocs' =&gt; 
              array (size=0)
                empty
  </code></pre>
  
  <p>As you can see, it holds non-associative files, and then two folders, "Special Docs" and "ADocs". My problem is two-fold:</p>
  
  <p>First, I want to move the two folders to the top of the array so that they will be prominent in my view. Second, I want to sort the folders alphabetically (i.e. put "ADocs" above "Special Docs". I have tried array_multisort without success and am sort of stuck here. Anyone know how I might achieve this?</p>
  
  <p>Thanks for your help. </p>