PHP 数组多条件排序技巧

2019-01-23  本文已影响4人  腿长袖子短
将相同订单号和相同订单时间的订单归类排序
            foreach ($data['msg'] as $v) 
            {
                $orderid = $v['order_id'];
                $time    = $v['virtual_time'];
                $id      = $orderid . $time;
            
                $arr[$id]['orderId']    = $v['order_id'];
                $arr[$id]['orderTitle'] = $v['order_title'];
                $arr[$id]['orderMoney'] = $v['order_money'];
                $arr[$id]['num']         = $v['num'];
                $arr[$id]['picPath']    = $v['pic_path'];
            
                $temp_data['virtualCode'] = $v['virtual_code'];
                $temp_data['virtualTime'] = date('Y-m-d H:i:s', $v['virtual_time']);
                $temp_data['money']        = $v['order_money'];
                $arr[$id]['code'][]        = $temp_data;
            }
上一篇 下一篇

猜你喜欢

热点阅读