Sort
(PHP3, PHP4)
Sort---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Rearrange the values of an array by a-Z
Syntax: void sort (array array [, int sort_flags]);
Description:
This function arranges the elements of an array by a-Z.
Example:
<?php
$fruits = Array ("Lemon", "orange", "banana", "apple");
Sort ($fruits);
for (Reset ($fruits); $key = key ($fruits); next ($fruits)) {
echo "fruits[$key] =". $fruits [$key]. " \ n ";
}
?>
The results of this example will produce:
Fruits[0] = Apple
FRUITS[1] = Banana
FRUITS[2] = Lemon
FRUITS[3] = Orange
Fruits arranged in the order of A-Z
Non-required second parameter sort_flags can use the following values to change the ordering change:
Sort Type flag:
Sort_regular-Normal comparison project
Sort_numeric-With a digital comparison project
Sort_string-as a string to compare items
Reference: Arsort () Asort () Ksort () Rsort () Usort ()