arsort
对数组进行降向排序并保持索引关系
&reftitle.description;
truearsort
arrayarray
intflagsSORT_REGULAR
对 array 本身按照降序排序,并保持数组的键与值之间的关联。
主要用于对那些单元顺序很重要的结合数组进行排序。
¬e.sort-unstable;
¬e.reset-index;
&reftitle.parameters;
array
输入的数组。
&sort.flags.parameter;
&reftitle.returnvalues;
&return.true.always;
&reftitle.changelog;
&Version;
&Description;
&return.type.true;
&reftitle.examples;
arsort 示例
"lemon", "a" => "orange", "b" => "banana", "c" => "apple");
arsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
]]>
&example.outputs;
fruits 被按照字母顺序逆向排序,并且单元的索引关系不变。
&reftitle.seealso;
sort
asort
&seealso.array.sorting;