note 93462 deleted from function.sort by danbrown

From: Date: Fri, 11 Sep 2009 15:39:53 +0000
Subject: note 93462 deleted from function.sort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-160464@lists.php.net to get a copy of this message
Note Submitter: Gavin G ---- In response to the comment by "danm68" about sorting strings alphabetically, I created a user-defined sorting function which compares lowercase strings: <?php function sortAlphabeticallyIgnoreCase($a, $b) { if ($a == $b) { return 0; } return (strtolower($a) < strtolower($b)) ? -1 : 1; } usort($myExampleArray, 'sortAlphabeticallyIgnoreCase'); ?> There may be a similar solution out there already (though I couldn't see one).

« previous php.notes (#160464) next »