note 30756 deleted from function.sort by didou
| From: | didou@php.net | Date: | Wed, 16 Jul 2003 09:43:02 +0000 |
| Subject: | note 30756 deleted from function.sort by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52176@lists.php.net to get a copy of this message | ||
Note Submitter: Rich Christiansen
----
Trying to sort an array without regard to case (case insensitive?) Try usort(). I needed to sort
an associated array without regard to case and this is what I came up with, from modifying the
example from the documentation for usort().
function cmp ($a, $b)
{
return strcasecmp($a["field_name"], $b["field_name"]);
}
uasort($array, "cmp");
-RIch