Home > php教程 > PHP源码 > body text

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

WBOY
Release: 2016-06-08 17:24:20
Original
874 people have browsed it

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

<script>ec(2);</script>

二维数组

 代码如下 复制代码
$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); 

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!