Do you mean something like www.php.net/ksort or www.php.net/krsort?
I'm not sure of the actual structure of your array, though, so those might
not work as expected.
/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net
: Sunday, July 08, 2001 1:33 AM
To: Aaron Bennett
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sort an array by its values
Do you mean something like www.php.net/ksort or www.php.net/krsort?
I'm not sure of the actual structure of your array, though, so those might
not work as expected.
/* Chris Lambert
PROTECTED]; Aaron
Bennett [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, July 08, 2001 4:34 AM
Subject: RE: [PHP] Sort an array by its values
| Chris,
| I'm looking at ksort as i type... the problem i'm having is that i'm
| trying to sort a value inside an object inside that array (rather
I think array_multisort is supposed to do this but I couldn't get it to
work.
Have a look at the usort call in the following routine;
// Reads a directory and puts filenames into a array sorted by date
function GetFiles ($DataPath, $files, $nfiles) {
$handle=@opendir($DataPath);
if
-
From: Chris Lambert - WhiteCrown Networks [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 08, 2001 1:38 AM
To: Aaron Bennett
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Sort an array by its values
Can you print_r($variable) and post it here?
/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown
Try something like:
uasort($your_hash[$first_level][$any_second_level],
create_function('$a,$b', 'return $a[what_level] -
$b[what_level];'));
and adjust this according to the level and what you want to sort on
accordingly...
_jef
Aaron Bennett wrote:
Hi All,
6 matches
Mail list logo