note 118198 added to function.array-multisort
| From: | intsystem88 at gmail dot com | Date: | Sun, 25 Oct 2015 01:03:13 +0000 |
| Subject: | note 118198 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204016@lists.php.net to get a copy of this message | ||
See (rus): https://intsystem.org/coding/sortirovka-mnogomernyh-massivov-po-klyuchu-na-php/
Simple example:
<?php
$data=array(
array('text'=>'str1', 'year'=>'2010',
'author'=>10),
array('text'=>'str2', 'year'=>'2011',
'author'=>10),
array('text'=>'str3', 'year'=>'2009',
'author'=>20),
array('text'=>'str4', 'year'=>'2010',
'author'=>30),
array('text'=>'str5', 'year'=>'2010',
'author'=>20),
array('text'=>'str6', 'year'=>'2011',
'author'=>10),
array('text'=>'str7', 'year'=>'2011',
'author'=>20),
array('text'=>'str8', 'year'=>'2009',
'author'=>20),
);
$data_year=array();
foreach($data as $key=>$arr){
$data_year[$key]=$arr['year'];
}
for($i=0; $i<100000; $i++){
$data_tmp=$data;
array_multisort($data_year, SORT_NUMERIC, $data_tmp);
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 46.173.12.134
----
Manual Page -- http://php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/118198
Del: integrated -- https://master.php.net/note/delete/118198/integrated
Del: useless -- https://master.php.net/note/delete/118198/useless
Del: bad code -- https://master.php.net/note/delete/118198/bad+code
Del: spam -- https://master.php.net/note/delete/118198/spam
Del: non-english -- https://master.php.net/note/delete/118198/non-english
Del: in docs -- https://master.php.net/note/delete/118198/in+docs
Del: other reasons-- https://master.php.net/note/delete/118198
Reject -- https://master.php.net/note/reject/118198
Search -- https://master.php.net/manage/user-notes.php