note 33783 deleted from function.array-multisort by aidan
| From: | aidan@php.net | Date: | Sun, 03 Oct 2004 10:40:26 +0000 |
| Subject: | note 33783 deleted from function.array-multisort by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77794@lists.php.net to get a copy of this message | ||
Note Submitter: rabidness\AT-NOSPAM-hotmail/dot\co_+_m
----
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.
<?php
// 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.