multidimensional array sort

From: Date: Mon, 14 Mar 2005 19:12:19 +0000
Subject: multidimensional array sort
Groups: php.general 
Request: Send a blank email to php-general+get-210683@lists.php.net to get a copy of this message
I have a multidimensional array that's built as follows (it's pretty much a directory tree): Array ( [Dir1] => Array (
     [User1] => Array (
         [0] => File1
         [1] => File2
     )
     [User2] => Array {
         [0] => File1
         [1] => File2
         [2] => File3
     }
) [Dir2] => Array (
     [User1] => Array (
         [0] => File1
         [1] => File2
         [2] => File3
         [3] => File4
     )
     [User2] => Array {
         [0] => File1
     }
) ) I need to do a sort on the whole thing in such a way that:
      a) all the Dir#'s are in ascending order, and
      b) all the User#'s are in ascending order with each Dir#, and
      b) all the File#'s are also in ascending order within each User#
I don't suppose there's an easy way to do this, other than doing it in several steps, is there? Is there even a way to JUST sort the Dir#'s (and the rest gets done at a later stage in the script)? -- A

« previous php.general (#210683) next »