【小(xiǎo)編推薦】PHP 二維數(shù)組根 ¥€據某個(gè)字段排序

2016-06-04   |&n'​↑ bsp;  發布者:梁國(guó)芳 &n$÷bsp; |  &nb↑>sp;查看(kàn):3320次

php
 $sort = array(  
        'direction α♦φ' => 'SORT_ASC', //排序↕ε順序标志(zhì) SORT_DESC 降序;SORT_ASC 升序φ¶₽  
      &♦∏nbsp; 'field'     => 'd☆£≥istance',     &n≥₹✔↔bsp; //排序字段  
     ±↑ Ω   );  
      &nb←≥sp; $arrSort = array(λ↑•);  
        foreacφ ✘↑h($dizhi AS $uniqid => $r✘•↓®ow){  
        &nbs©←≤&p;   foreach($row AS $key=>↔‍≈δ;$value){  
      &nΩΩδαbsp;       &nbs↑♣φ★p; $arrSort[$key][$uni&✔qid] = $value;  
         §‌;   }  
        } &nbs★‍→±p;
      ¥×€  if($sort['direction']★<±){  
        &nb♦φ​αsp;   array_multisort(γ★€←$arrSort[$sort['field']], c‍  onstant($sort['direction']), $dizhi); &n©®§bsp;
       ×πδ; }