本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>技术文章>>php技术文章
小戴个人门户站导航 PHP小戴个人门户站 关于站长web个人门户站 设计服务-网络公司,建设网站,企业logo设计,包装设计,网站设计,整站程序开发 联系站长-小戴个人门户站
  • 技术文章排行榜
文章数据加载中...
  • 免费空间排行榜
空间数据加载中...

php数组排序实例

  • 数组排序实例

    <?php $ar = array (    
    array ( 'key' => '69931',
         'hname' => 'eee',
         'hsex' => '女',
         'hhunfou' => '未婚',
         'hshouji' => 'ee',
         'hmail' => 'er',
         'ips' => '24#72.30.142.252',
         'hqq' => 're',
         'ifpaishe' => 2,
         'username' => 'jiayang3401',
         'clicks' => 10,
         'hyinglou' => '无' ),    
    array ( 'key' => '81',
         'hname' => 'susan',
         'hsex' => '女',
         'hhunfou' => '未婚',
         'hshouji' => '0000',
         'hmail' => '0000',
         'ips' => '24#72.30.142.252#221.215.68.22#221.3.83.98',
         'hqq' => '0000',
         'ifpaishe' => 1,
         'username' => 'susan',
         'clicks' => 15,
         'hyinglou' => '摄影名店' ),    
    array ( 'key' => '101440',
         'hsex' => '女',
         'hhunfou' => '已婚',
         'hshouji' => '13853276763',
         'ips' => '24#202.160.179.19#221.3.83.98',
         'ifpaishe' => 2,
         'username' => 'NIKI',
         'clicks' => 3,
         'hyinglou' => '无' ),    
    array ( 'key' => '101440',
         'hsex' => '女',
         'hhunfou' => '已婚',
         'hshouji' => '13853276763',
         'ips' => '24#202.160.179.19#221.3.83.98',
         'ifpaishe' => 2,
         'username' => 'NIKI',
         'clicks' => 3,
         'hyinglou' => '无' ),    
    array ( 'key' => '101440',
         'hsex' => '女',
         'hhunfou' => '已婚',
         'hshouji' => '13853276763',
         'ips' => '24#202.160.179.19#221.3.83.98',
         'ifpaishe' => 2,
         'username' => 'NIKI',
         'clicks' => 3,
         'hyinglou' => '无' ),    
    array ( 'key' => '101440',
         'hsex' => '女',
         'hhunfou' => '已婚',
         'hshouji' => '13853276763',
         'ips' => '24#202.160.179.19#221.3.83.98',
         'ifpaishe' => 2,
         'username' => 'NIKI',
         'clicks' => 3,
         'hyinglou' => '无' ),    
    array ( 'key' => '101440',
         'hsex' => '女',
         'hhunfou' => '已婚',
         'hshouji' => '13853276763',
         'ips' => '24#202.160.179.19#221.3.83.98',
         'ifpaishe' => 2,
         'username' => 'NIKI',
         'clicks' => 3,
         'hyinglou' => '无' ),    
    );


    foreach($ar as $v)
      $t[] = $v['clicks'];

    array_multisort($t, $ar); //排序
    print_r(array_slice($ar, 0, 3)); //取出前3条

    ?>

    自己测试下!!!


  • [时间:2009-01-01 19:28:44][点击:]

  • 上下篇文章加载中...
返回首页 | 关于站长 | 联系站长| 设计服务 | 建站资源 | 技术文章 | 娱乐中心 | 免费空间 | 友情链接 | 留言蜚语 | 网站地图| 网友投稿|RSS订阅 
QQ:277728291 联系方式:15824537062 mail:27772821@163.com
版权所有 2008-2018 PHP小戴个人门户站-编程技术和空间和文章共享-www.phpxd.com Copyright 2008 phpxd.com