Ask a Question related to PHP Notes, Design and Development.
-
Rabidness\\At-Nospam-Hotmail/Dot\\Co + M #1
note 33783 added to function.array-multisort
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,$ar rSort,
SORT_ASC,SORT_STRING);
There you go.
----
Manual Page -- [url]http://www.php.net/manual/en/function.array-multisort.php[/url]
Edit Note -- [url]http://master.php.net/manage/user-notes.php?action=edit+33783[/url]
Delete Note -- [url]http://master.php.net/manage/user-notes.php?action=delete+33783&report=yes[/url]
Reject Note -- [url]http://master.php.net/manage/user-notes.php?action=reject+33783&report=yes[/url]
Rabidness\\At-Nospam-Hotmail/Dot\\Co + M Guest
-
note 33944 added to function.array-combine
// Here's another pre PHP 5 alternative. function array_combine($keys, $vals) { $i = 0; foreach ($keys as $key) { $newarray = $vals; } return... -
note 33891 added to function.array-multisort
I needed a function that would apply the same user-defined sort on the keys of each level of a multi-dimensional array (i.e. it would first sort the... -
note 33865 added to function.array
I found a slightly better way to create large 2d arrays: // this will simply output a 2d array-- it isn't very robust but it //suits my needs... -
note 33861 added to function.array-reverse
u all suck dick u fancy bastards ---- Manual Page -- http://www.php.net/manual/en/function.array-reverse.php Edit Note --... -
note 33742 added to function.in-array
Be careful... This script was designed to check for required fields: $required = array('put','required','field','names','here'); foreach...



Reply With Quote

