Re: Sort an array by it's values
| From: | Michal Migurski | Date: | Mon, 26 Apr 2004 14:08:46 +0000 |
| Subject: | Re: Sort an array by it's values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184644@lists.php.net to get a copy of this message | ||
> Is there a command similar to asort() that will sort the elements of an
> array not by their key values but by the element values?
asort() /does/ sort by element value, it just maintains index association.
Plain old sort() does not.
If you actually want to sort by key value, you want ksort().
There's a complete list of all the sort functions at:
http://php.net/manual/en/ref.array.php
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html