Re: multidimensional array sort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leif Gregory wrote:

http://us3.php.net/manual/en/function.array-multisort.php

I did go through that, but I can't get it to work and I'm almost willing to bet it's because of the way the array is built. For example, the example on that page says that I should be able to do a sort on $ar[0] and $ar[1], however in my array both of those return 0. In fact, when I do this:

echo "items in array: " . count($data) . "<br />"; for ($i = 0; $i < count($data); $i++) {
echo "data[$i]: " . count($data[$i]) . "<br />";
}



I get:

     items in array: 2
     data[0]: 0
     data[1]: 0



   When I do a print_r($data), I get:

     Array
       (
          [John] => Array
             (
                [KIRASH] => Array
                  (
                     [0] => 050311_18.00.59__KIRASH.zip
                     [1] => 050311_18.10.20__KIRASH.zip
                  )
                [MCCROY] => Array
                  (
                     [0] => 050312_20.52.28__MCCROY.zip
                  )
             )

          [Ron] => Array
             (
                [EMBROR] => Array
                  (
                     [0] => 050314_15.47.56__EMBROR.zip
                  )
             )
       )


Soooo, I'm at a loss here. I think I need to create the array differently for it to work.


--
H | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@xxxxxxxxxx> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Imaging . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux