• 用于二维数组排序


    function array_sort($arr, $field, $by = SORT_ASC)
    {
        foreach ($arr as $v) {
            $r[] = $v[$field];
        }
        array_multisort($r, $by, $arr);
        return $arr;
    }
     
    function sort_array($array, $keyid, $order='asc', $type='number') {
        if(is_array($array)) {
            foreach($array as $val) {
                $order_arr[] = $val[$keyid];
            }
      
            $order = ($order == 'asc') ? SORT_ASC: SORT_DESC;
            $type  = ($type == 'number') ? SORT_NUMERIC: SORT_STRING;
      
            array_multisort($order_arr, $order, $type, $array);
        }
    }
     
    ——————————————
    if($res){
    foreach ($res as $k=>$v) {
    $res[$k]['list_bonus']=$v['list-bonus'];
    $res[$k]['rebate_level']=$v['active_rebate_level'];
    $qnum[$k]=$v['qnum'];
    $posttime[$k]=$v['posttime'];
    }
    array_multisort($posttime,SORT_NUMERIC,SORT_DESC,$qnum,SORT_NUMERIC,SORT_DESC,$res);
    }
  • 相关阅读:
    Linux Process Memory Usage
    ezwinports
    Linux程序调试查看二进制文件
    Build tcpdump for ARM
    Tomcat start/stop script
    Apache+PHP+MySQL
    查看安装的glibc版本
    CodeMirror
    GeSHi Generic Syntax Highlighter
    C++命令行解析库
  • 原文地址:https://www.cnblogs.com/csjoz/p/7244049.html
Copyright © 2020-2023  润新知