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

Posted by Ashley M. Kirchner on 03/15/05 04:29

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@pcraft.com> . 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.

 

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

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