数组排序
2021-06-17 01:06
标签:pre int app values 根据 new iso print value 数组排序 标签:pre int app values 根据 new iso print value 原文地址:https://www.cnblogs.com/guiking/p/9723059.html数组排序
$sort = array_column($list, ‘uv‘);
array_multisort($sort, SORT_DESC, $list);
数组分页(用tp分页)$list_print = $list;
$count = count($list);
$page_num = 20;
$Page = new \Think\Page($count, $page_num);
$list = array_slice($list, $Page->firstRow, $Page->listRows);
根据数组中相同的某些指定的值去重$list = 你查询出来得数据有重复值;
$result = array();
foreach ($list as $val) {
$key = $val[‘app_id‘] . $val[‘app_name‘] . $val[‘date‘] . $val[‘pv‘] . $val[‘uv‘] . $val[‘new_user‘];
if (!isset($result[$key])) {
$result[$key] = $val;
}
}
$list = array_values($result);