数组 - php array_multisort()函数用法

WBOY
Release: 2016-06-06 20:52:16
Original
947 people have browsed it

用这个函数在排序时字符串键名将被保留,但是数字键名将被重新索引,从 0 开始,并以 1 递增。我现在的需求是数字键名也要保留,不希望被重写索引。有什么好的解决办法吗?

回复内容:

用这个函数在排序时字符串键名将被保留,但是数字键名将被重新索引,从 0 开始,并以 1 递增。我现在的需求是数字键名也要保留,不希望被重写索引。有什么好的解决办法吗?

如果数组不是很大的话,可以用PHP自己实现一个快排,要不了几行。数组很大、对效率要求高的话,就写个扩展吧。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!