(PHP 4, PHP 5, PHP 7)
arsort — 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷虿⒈锟斤拷锟斤拷锟斤拷锟斤拷锟较�
&$array
[, int $sort_flags
= SORT_REGULAR
] ) : bool锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街和碉拷元锟侥癸拷锟斤拷锟斤拷
锟斤拷要锟斤拷锟节讹拷锟斤拷些锟斤拷元顺锟斤拷锟斤拷锟揭拷慕锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
Note:
If two members compare as equal, their relative order in the sorted array is undefined.
array
锟斤拷锟斤拷锟斤拷锟斤拷椤�
sort_flags
锟斤拷锟斤拷锟矫匡拷选锟侥诧拷锟斤拷 sort_flags
锟侥憋拷锟斤拷锟斤拷锟斤拷锟轿拷锟斤拷锟斤拷锟斤拷 sort()锟斤拷
锟缴癸拷时锟斤拷锟斤拷 TRUE
锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
Example #1 arsort() 锟斤拷锟斤拷
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
arsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�
a = orange d = lemon b = banana c = apple
fruits 锟斤拷锟斤拷锟斤拷锟斤拷母顺锟斤拷锟斤拷锟斤拷锟斤拷锟津,诧拷锟揭碉拷元锟斤拷锟斤拷锟斤拷锟斤拷系锟斤拷锟戒。