----- Original Message -----
From: "Joachim Krebs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 17, 2003 8:25 AM
Subject: [PHP] Multisorting an array


> I have an array with the following structure:
>
> Array
> (
>     [0] => Array
>         (
>             [name] => images
>             [type] => dir
>         )
>
>     [1] => Array
>         (
>             [name] => includes
>             [type] => dir
>         )
>
>     [2] => Array
>         (
>             [name] => index.php
>             [type] => file
>         )
>
>     [3] => Array
>         (
>             [name] => index.tpl.php
>             [type] => file
>         )
>
>     [4] => Array
>         (
>             [name] => lib
>             [type] => dir
>         )
> }
>
> I want to array_multisort this array so it becomes sorted by type
> first, and then by name. What are the arguments for the function in
> this case?
>
> Joachim

I do not believe there are any arguments to the array_multisort() functon
that will help you in this case.  Sometimes you just need to backup and try
to see the problem in a new light.  Instead of building a large
multi-dimensional array you might consider building two one-dimensional
arrays (one for files and one for directories).  That solves half of your
problem right there.  Then all you need to do is sort each array using
asort() and you can combine them or print them out in whatever order you
like.
- Kevin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to