string(16) "1001"   &"/>     string(16) "1001"   &">

Home >Backend Development >PHP Tutorial > 一个数组排序的有关问题

一个数组排序的有关问题

WBOY
WBOYOriginal
2016-06-13 12:53:25820browse

一个数组排序的问题

<br />
array(22) {<br />
  [0]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1001"<br />
    ["PicMemo"]=><br />
    string(3) "102"<br />
  }<br />
  [1]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1005"<br />
    ["PicMemo"]=><br />
    string(3) "15"<br />
  }<br />
  [2]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1002"<br />
    ["PicMemo"]=><br />
    string(3) "102"<br />
  }<br />
  [3]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1003"<br />
    ["PicMemo"]=><br />
    string(3) "171"<br />
  }<br />
  [4]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1004"<br />
    ["PicMemo"]=><br />
    string(3) "102"<br />
  }<br />
  [5]=><br />
  array(6) {<br />
    ["CheckID"]=><br />
    string(16) "1005"<br />
    ["PicMemo"]=><br />
    string(3) "171"<br />
  }<br />
  ...<br />
 }<br />

数组$arr;按照 'PicMemo'排序 将相同的值放在一起,键重组;
3q了!


------解决方案--------------------
foreach($ar as $v) $r[] = $v['PicMemo'];
array_multisort($r, $ar);
print_r($ar);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn