[PHP] sorting multidimensional array by a second level value

2004-09-17 Thread Chris Lott
I have an array $links like this:

[1] = Array
(
[href] = http://www.poetrymagazine.org/epstein_sept_prose.html
[description] = Thank You, No
[time] = 2004-09-17T17:30:32Z
)

[2] = Array
(
[href] = http://110am.com/projects/manuscript/
[description] = Manuscript
[time] = 2004-09-16T19:25:14Z
)

I'd like to sort the array based on one of the values in the field
href, description, or time. Is there a canonical way of doing this?

c
-- 
Chris Lott

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



Re: [PHP] sorting multidimensional array by a second level value

2004-09-17 Thread Jason Davidson
http://ca3.php.net/manual/en/function.array-multisort.php

this might do it.

Jason

Chris Lott [EMAIL PROTECTED] wrote: 
 
 I have an array $links like this:
 
 [1] = Array
 (
 [href] = http://www.poetrymagazine.org/epstein_sept_prose.html
 [description] = Thank You, No
 [time] = 2004-09-17T17:30:32Z
 )
 
 [2] = Array
 (
 [href] = http://110am.com/projects/manuscript/
 [description] = Manuscript
 [time] = 2004-09-16T19:25:14Z
 )
 
 I'd like to sort the array based on one of the values in the field
 href, description, or time. Is there a canonical way of doing this?
 
 c
 -- 
 Chris Lott
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] sorting multidimensional array by a second level value

2004-09-17 Thread Steve Brown
 I'd like to sort the array based on one of the values in the field
 href, description, or time. Is there a canonical way of doing this?

Probably easiest to write your own sort function the use usort(), 
http://www.php.net/usort has pretty good documentation on how to
accomplish this.

Steve

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



Re: [PHP] sorting multidimensional array by a second level value

2004-09-17 Thread Matt M.
  I'd like to sort the array based on one of the values in the field
  href, description, or time. Is there a canonical way of doing this?

you might be able to use http://us2.php.net/manual/en/function.usort.php

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