先看一维数据排序的实例asort()函数和ksort()函数<?php
//asort()函数以数组的值升序为准
$mix = array(“Clalei”=>10,”Bill”=>50,”Aala”=>100);
asort($mix);
print_r($mix);
//ksort()函数以数组的关键字升序为准
$mix = array(“Clalei”=>100,”Bill”=>50,”Aala”=>10);
ksort($mix);
print_r($mix);
?>一维数据排序二sort()函数,可将数组按字母或是数字的升序(从低到高)来进行排序:<?php
$name = array(“Clalei”,”Bill”,”Aala”);
sort($name);
for($i=0;$i<3;$i++){
echo $name[$i];
}
echo “
”;
$pri...