Home  >  Article  >  Backend Development  >  数组 - php array_multisort()函数用法

数组 - php array_multisort()函数用法

WBOY
WBOYOriginal
2016-06-06 20:52:16945browse

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

回复内容:

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

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

Statement:
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