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);}
时间: 2024-10-24 05:11:21