ts10 wrote:I'm attempting to sort a multi-dimensional array based on territory.
I tried:
array_multisort($stateList[$a][$b]["Territory"]);
But I just got errors. I couldn't find an applicable example on php.net.
Any suggestions on how to sort this?
I have done some work, study of this last year (2007)
So, I have written my own 'perfect' multi_dim array sort function.
The hook is that you can often not just run [man]array_multisort[/man] on your array.
For example, if you pull several rows from DB
you have an array of rows where each row ALSO is an array of fields.
You then first need to prepare your input ARRAY for multisort.
After this you can run [man]array_multisort[/man]
Array Multi Sort is a very, very powerful PHP Function !!!! A real good one !!!
My own funtion uses array_multisort()
and was specially designed to deal with DB Rows (from my Own flatfile DB-Class)
and sort rows by any FIELD, Column values.
You should take a peak of user submitted comments/code
in that PHP Manual link:
http://docs.php.net/array_multisort
There are several VERY GOOD functions submitted 😉
Regards
halojoy
.