Re: sorting associative array
| From: | Jochem Maas | Date: | Mon, 24 Jan 2005 12:05:47 +0000 |
| Subject: | Re: sorting associative array | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207114@lists.php.net to get a copy of this message | ||
...
ok, does that mean using usort() on your array works? my class is just a fancy wrapper around usort - and ofcourse it allows you to sort on more than 1 'column' in the second dimension of the array (kind of like a multi-column sort in an SQL statement). -- the point being that the usort() example Kurt (I think that was his name) sent would work also. anyway glad you could use it. :-) ....Thanks jochem, I had a second look at it and I figured it out. I had problem implementing it with a class but now I have figured how to use it. cheers, Jefferywhich wont help much - assuming what you say is true (why wont it work? have you tried it). sort method from the class:This won't work for me as I have 500+ records to sort based on the score key.. looking at jochem's class now. Thanksfunction sort() { if(count($this->sortKeys)) { usort($this->dataArray, array($this,"_sortcmp")); } }