升序:sort()函数
降序:rsort()函数
$people=array('name','sex','nation','birth');
foreach ($people as $mychrs)
echo $mychrs." ";
sort($people);
echo "
---排序后---
";
foreach ($people as $mychrs)
echo $mychrs." ";
?>
PHP中除了升序函数以外,还有降序或称反向排列的函数,就是rsort()函数,比如:
$num1=range(1,9);
rsort($num1);
这里其实就相当于range(9,1)