Re: case insensitive sort
| From: | Steve Buehler | Date: | Tue, 26 Aug 2003 15:52:23 +0000 |
| Subject: | Re: case insensitive sort | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160786@lists.php.net to get a copy of this message | ||
Ok. Now I REALLY feel like an idiot. Thanks so much for your help.
Steve
At 05:46 PM 8/26/2003 +0200, you wrote:
It right there under your nose: strcasecmp() Steve Buehler wrote: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;-- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean.return strcmp($a[$sortterm], $b[$sortterm]);} Thanks Steve