Home  >  Article  >  Backend Development  >  Dive into the PHP array_multisort_PHP tutorial

Dive into the PHP array_multisort_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:33:11865browse

For first time learning

Like this array_multisort($arr1,$arr2,$arr3); The default is that all arrays are sorted in ascending order. If you want to sort $arr2 in descending order , and treated as strings for comparison, it must be written as:

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

Each array can be followed by a sort order flag or a sort type flag, or both flags. But only one sort flag of each type can appear after each array.

PHP array_multisort sort order flags:

SORT_ASC - Sort in ascending order (default)

SORT_DESC - Sort in descending order

PHP array_multisort sort type flag:

SORT_REGULAR - compare items according to the usual method (default)

SORT_NUMERIC - compare items numerically

SORT_STRING - Compare items by string


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446072.htmlTechArticleFor first time learning like this array_multisort($arr1,$arr2,$arr3); The default is that all arrays are in ascending order Arrange, if you want to sort $arr2 in descending order and compare it as a string, you must write: ar...
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