若是不使用Arrays 类的 sort( ) 方法,要怎么实现排序?
function fsSort($arr){
$tmp = $arr;
$min = '';
for($i=0;$i<count($arr);$i++){
for($j=$i;$j<count($arr);$j++){
if($tmp[$i]>$tmp[$j]){
$a=$tmp[$j];
$tmp[$j]=$tmp[$i];
$tmp[$i]=$a;
}
}
}
return $tmp;
}今天写的自定义函数排序,排数字一维数组大小
自己写方法实现排序