note 79491 added to function.array-multisort
| From: | glenn at freebsd dot nl | Date: | Thu, 29 Nov 2007 18:49:27 +0000 |
| Subject: | note 79491 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132671@lists.php.net to get a copy of this message | ||
To sort a nested array by column (key/index):
Example: two entries in the nested array:
firstarray[0]['adres'] = "adres1"
firstarray[0]['email'] = "email2"
firstarray[1]['adres'] = "adres2"
firstarray[1]['email'] = "email1"
-----------------------------------------
Without code: output would put adres1/email2 on top
-----------------------------------------
foreach($firstarray as $sortarray)
{
$column[] = $sortarray['email'];
array_multisort($column, SORT_ASC, $firstarray);
}
-----------------------------------------
With code: output would put adres2/email1 on top
----
Server IP: 213.249.64.162
Probable Submitter: 62.195.71.45
----
Manual Page -- http://www.php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/79491
Del: integrated -- https://master.php.net/note/delete/79491/integrated
Del: useless -- https://master.php.net/note/delete/79491/useless
Del: bad code -- https://master.php.net/note/delete/79491/bad+code
Del: spam -- https://master.php.net/note/delete/79491/spam
Del: non-english -- https://master.php.net/note/delete/79491/non-english
Del: in docs -- https://master.php.net/note/delete/79491/in+docs
Del: other reasons-- https://master.php.net/note/delete/79491
Reject -- https://master.php.net/note/reject/79491
Search -- https://master.php.net/manage/user-notes.php