PHP 数组多条件排序技巧
作者:
腿长袖子短 | 来源:发表于
2019-01-23 10:44 被阅读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;
}
本文标题:PHP 数组多条件排序技巧
本文链接:https://www.haomeiwen.com/subject/vshjjqtx.html
网友评论