note 118730 added to function.uasort
| From: | temper26 at yandex dot ru | Date: | Wed, 27 Jan 2016 13:39:32 +0000 |
| Subject: | note 118730 added to function.uasort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204782@lists.php.net to get a copy of this message | ||
ÑоÑÑиÑовка маÑÑива Ñ
одинаковÑми знаÑениÑми
$sortPos = 0;
foreach($arResult['ITEMS'] as $k=>&$arItem) {
$arItem['SORT_POS'] = ++$sortPos;
}
unset($arItem);
uasort($arResult['ITEMS'],function($a,$b){
if ($a['SORT']==$b['SORT']) {
return ($a['SORT_POS'] < $b['SORT_POS']) ? -1 : 1;
}
return ($a['SORT']<$b['SORT']) ? -1 : 1;
});
----
Server IP: 84.234.75.250
Probable Submitter: 81.95.134.98
----
Manual Page -- http://php.net/manual/en/function.uasort.php
Edit -- https://master.php.net/note/edit/118730
Del: integrated -- https://master.php.net/note/delete/118730/integrated
Del: useless -- https://master.php.net/note/delete/118730/useless
Del: bad code -- https://master.php.net/note/delete/118730/bad+code
Del: spam -- https://master.php.net/note/delete/118730/spam
Del: non-english -- https://master.php.net/note/delete/118730/non-english
Del: in docs -- https://master.php.net/note/delete/118730/in+docs
Del: other reasons-- https://master.php.net/note/delete/118730
Reject -- https://master.php.net/note/reject/118730
Search -- https://master.php.net/manage/user-notes.php