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;
    return strcmp($a[$sortterm], $b[$sortterm]);
}

Thanks
Steve


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to