note 20498 added to function.natcasesort

From: Date: Fri, 05 Apr 2002 13:01:23 +0000
Subject: note 20498 added to function.natcasesort
Groups: php.notes 
Request: Send a blank email to php-notes+get-28663@lists.php.net to get a copy of this message
natcasesort didn't work first time I needed something like this. Not on my local server, not on my server on the web. I needed an array sorted ignoring upper and lower cases. In the end lower case array-members stayed at the end of the array. I replaced it with this function: --------- function ignorecasesort(&$array) { $separator="|<>|"; for($i=0;$i<sizeof($array);$i++) { $array[$i]=strtolower($array[$i]).$separator.$array[$i]; } sort($array); for($i=0;$i<sizeof($array);$i++) { $this=$array[$i]; $this=explode($separator,$this); $array[$i]=$this[1]; } } --------- -- http://www.php.net/manual/en/function.natcasesort.php http://master.php.net/manage/user-notes.php?action=edit+20498 http://master.php.net/manage/user-notes.php?action=delete+20498 http://master.php.net/manage/user-notes.php?action=reject+20498

« previous php.notes (#28663) next »