Home > Backend Development > PHP Tutorial > PHP中二维数组排序怎么排

PHP中二维数组排序怎么排

WBOY
Release: 2016-06-13 09:59:21
Original
840 people have browsed it

PHP中二维数组排序如何排
如题,因为这个员工数组是在从数据库里取出来后经过处理的,不是直接取出的,所以不能用mysql语句进行排序,而这个数组又是保存记录的二维数组,要求是按照不同字段进行排序,php中multisort不能直接拿来用,好像也不存在矩阵转换的函数。所以关于这个数组如何进行排序,求解

------解决方案--------------------
分两步走
1、取出原数组中作为排序键的成员放入新数组。这相当于做索引
2、用 array_multisort 排序这两个数组

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template