Asort
(PHP3, PHP4)
Asort---A relationship that arranges arrays and maintains index values
Grammar: void&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;" Asort (array array);
Description:
This function rearranges the elements of an array by a-Z and retains the corresponding relationship between the original index value and the element, which is used primarily to rearrange the elements of the array.
Example:
<?php
$fruits = Array ("D" => "Lemon", "a" => "Orange", "B" => "banana", "C" => "Apple");
Asort ($fruits);
for (Reset ($fruits); $key = key ($fruits); next ($fruits)) {
echo "fruits[$key] =". $fruits [$key]. " \ n ";
}
?>
The results of this example are:
FRUITS[C] = Apple
FRUITS[B] = Banana
FRUITS[D] = Lemon
Fruits[a] = Orange
This shows that the array fruits has been rearranged, and that the relationship between the index values and elements remains unchanged.
Reference: Arsort () Rsort () Ksort () sort ()