Home  >  Article  >  php教程  >  PHP二维数组按照一个字段排序程序

PHP二维数组按照一个字段排序程序

WBOY
WBOYOriginal
2016-06-08 17:24:20801browse

一个PHP二维数组按照一个字段排序程序实现代码,有需要的朋友可参考参考。

二维数组

 代码如下 复制代码
$arr = array ( 
    array ( 'key' => '69931', 
         'hsex' => '女', 
         'username' => 'jiayang3401', 
         'clicks' => 10, 
         'hyinglou' => '无' ),      
    array ( 'key' => '81', 
         'hsex' => '女', 
        'username' => 'susan', 
         'clicks' => 15, 
     'hyinglou' => '摄影名店' ),      
);   

 


 代码如下 复制代码

foreach($arr as $vo){ 
    $t[] = $vo['clicks']; 

array_multisort($t, $arr);//排序 
var_dump($arr); 

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