对于一维数组排序比较简单,像使用sort(),asort(),arsort()等函数进行排序,但是对于二维数组比较麻烦,所有借鉴网上的总结了一下
// 对二维数组进行指定key排序 $arr 二维数组 ,$shortKey 需要排序的列,$short 排序方式 $shortType 排序类型 function multi_array_sort($arr,$shortKey,$short=SORT_DESC,$shortType=SORT_REGULAR) { foreach ($arr as $key => $data){ $name[$key] = $data[$shortKey]; } array_multisort($name,$shortType,$short,$arr); return $arr; }
继续阅读与本文标签相同的文章
-
Spring Cloud Zuul的动态路由怎样做?集成Nacos实现很简单
2026-05-19栏目: 教程
-
springboot自动配置原理
2026-05-19栏目: 教程
-
Windows10下载mysql详解
2026-05-19栏目: 教程
-
强强联合 阿里云 RDS for SQL Server 与 金蝶 K/3 WISE 产品实现兼容适配
2026-05-19栏目: 教程
-
给网站添加微信扫描二维码登录功能
2026-05-19栏目: 教程
