note 33783 added to function.array-multisort
| From: | "rabidness\\AT-NOSPAM-hotmail/dot\\co_+_m" at rack1 dot php dot net | Date: | Mon, 07 Jul 2003 20:04:08 +0000 |
| Subject: | note 33783 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51648@lists.php.net to get a copy of this message | ||
In responce to this:
"It should be noted that both SORT_REGULAR and SORT_STRING appear ot be case sensitive, list
words beginning with capitals first.
It would be nice to have an option which isn't case sensitive.
Allen"
To Make a SORT_STRING ignore case, simply sort without any different cases. By use of the
strtolower() or strtoupper() functions.
The $arrMerch[$iIndex][1] cell contains a string, of course.
// Create an array that will be sorted, with strtolower() making all the strings lower case.
for ($iIndex = 0; $iIndex < $iAppCount; $iIndex++) {
$arrSort[$iIndex] = strtolower($arrMerch[$iIndex][1]);
}
array_multisort($arrMerch,SORT_ASC,SORT_STRING,$arrSort,
SORT_ASC,SORT_STRING);
There you go.
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33783
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33783&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33783&report=yes