Home > php教程 > php手册 > body text

深入探讨PHP array_multisort

WBOY
Release: 2016-06-13 11:10:28
Original
947 people have browsed it

对于初次学习

像这样array_multisort($arr1,$arr2,$arr3); 默认是所有数组都是升序排列,如果想对$arr2降序,并当作字符串去比较,就要写成:

array_multisort($arr1, $arr2, SORT_DESC, SORT_STRING, $arr3);

每个array后面可以跟一个排序顺序标志或一个排序类型标志,或者两种标志同时出现。但是每种排序标志在每个数组后面只能出现一个。

PHP array_multisort排序顺序标志:

SORT_ASC - 按照上升顺序排序(默认)

SORT_DESC - 按照下降顺序排序

PHP array_multisort排序类型标志:

SORT_REGULAR - 将项目按照通常方法比较(默认)

SORT_NUMERIC - 将项目按照数值比较

SORT_STRING - 将项目按照字符串比较


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template