note 94883 added to function.uasort
| From: | paul at webtop-designs dot com | Date: | Mon, 30 Nov 2009 21:40:07 +0000 |
| Subject: | note 94883 added to function.uasort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163435@lists.php.net to get a copy of this message | ||
Just expanding on php arobase kochira period com's method:
If you are looking to sort a multi-D array by a specific column and have entries in both upper and
lower case, simply drop the entries to lowercase before doing the strcmp.
$dirs = array(
array('name' => 'First Folder', 'path' =>
'sompath'),
array('name' => 'second folder', 'path' =>
'sompath2'),
array('name' => 'Third Folder', 'path' =>
'sompath3')
);
function so($a, $b) {
return (strcmp (strtolower($a['name']), strtolower($b['name'])));
}
----
Server IP: 208.69.120.55
Probable Submitter: 70.162.123.221
----
Manual Page -- http://www.php.net/manual/en/function.uasort.php
Edit -- https://master.php.net/note/edit/94883
Del: integrated -- https://master.php.net/note/delete/94883/integrated
Del: useless -- https://master.php.net/note/delete/94883/useless
Del: bad code -- https://master.php.net/note/delete/94883/bad+code
Del: spam -- https://master.php.net/note/delete/94883/spam
Del: non-english -- https://master.php.net/note/delete/94883/non-english
Del: in docs -- https://master.php.net/note/delete/94883/in+docs
Del: other reasons-- https://master.php.net/note/delete/94883
Reject -- https://master.php.net/note/reject/94883
Search -- https://master.php.net/manage/user-notes.php