[PHP] multidimensional array sort

[PHP] multidimensional array sort

Post by ashle » Wed, 16 Mar 2005 11:29:19



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: XXXX@XXXXX.COM > . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Imaging . 3550 Arapahoe Ave. #6
http://www.yqcomputer.com/ ..... . . . Boulder, CO 80303, U.S.A.
 
 
 

1. Split multidimensional array into 4 multidimensional arrays

2. Sort MultiDimensional Array

I would like to sort a 5926x12 array. I would like it first sorted by
Column 9-(integer value)-Date
then Column 2 (integer value)-Trailor #
then Column 11 (integer value)-Destination

I want to do this in VBA since that is where the array is. To copy it
to a worksheet, sort, and then reread the array would be time consuming
when the program is ran. I would like the end product to be as if I
had used the "Data", "Sort" command in excel with the Then bys filled
in. Any help would be greatly appreciated. I have searched for this
and have not found a conclusive answer. Thanks.

3. Sorting a multidimensional array

4. Sorting multidimensional arrays

5. Sorting a multidimensional array by time

6. Alpha multidimensional array sort

7. Sorting multidimensional array based on variable

8. Multidimensional arrays and arrays of arrays

9. Sorting a multidimensional array Second Request

10. sort multidimensional arrays?

11. Problem sorting an multidimensional array

12. sorting multidimensional array

13. How do a sort a multidimensional array(1000,2) in Excel-VBA?

14. Sorting Multidimensional Arrays

15. Problems sorting multidimensional array