You are here: multidimensional array sort « PHP « IT news, forums, messages
multidimensional array sort

Posted by Ashley M. Kirchner on 03/14/05 21:12

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация