Re: array_multisort
| From: | Brian White | Date: | Wed, 26 Sep 2001 23:48:32 +0000 |
| Subject: | Re: array_multisort | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68935@lists.php.net to get a copy of this message | ||
Ok. As far as I can tell from your example - you have a single
multidimensional array. From my reading of array_multisort
it looks like it is supposed to sort multiple arrays that happen
to be the same length, which is a little different.
Conceptually, what I think you have is an array of records which
you want to sort by one of the elements in the record. What I think
you want is "uasort", with something like:
function compare( $left, $right )
{
return ( $left[keycount] - $right[keycount] );} uasort( $result, "compare" ); At 03:43 26/09/2001 -0700, Richard Baskett wrote:
Ok i've gone through the archives.. and you know.. I don't think anybody really understands this function. I hope I am wrong, but here goes. I have an array called let's say.. $results first dimension are just numbers and the second has associative names [name],[title],[descript],[keycount] so basically $result[0][name] $result[0][title] $result[0][descript] $result[0][keycount] The first dimension goes up to hmm.. in the three digits and each has the four other "categories", I want to sort $result by [keycount] which are all numbers. How the umm.. heck do you use that funky array_multisort function? Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: bwhite@steptwo.com.au