case insensitive sort
| From: | Steve Buehler | Date: | Tue, 26 Aug 2003 15:31:51 +0000 |
| Subject: | case insensitive sort | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160782@lists.php.net to get a copy of this message | ||
I am using the following function for a sort on an array. I hope someone can help me out here and let me know how to change it to make it a "case insensitivie" sort. Right now, it is "case sensitive" so the sort of the array will put the Capital letters first. Here are the results of the search:
Buehler, Steve
Buehler, Steve
Teste, Teste
a, a
asdf, adsf
asdf, asdf
dsdlkj, sd
Here is the code to sort:
$GLOBALS[sortterm]="cont_name";
usort($logins, "cmp");
function cmp ($a, $b) {
GLOBAL $sortterm;
return strcmp($a[$sortterm], $b[$sortterm]);} Thanks Steve