荆轲刺秦王
使用原生PHP写一个冒泡排序算法:
<?php
// 从大到小排序
$numArray =array(3,2,6,5,8,10);
$numCount = count($numArray);
for($i=$numCount-1;$i>=0;$i--){
for($j=0;$j<$i;$j++){
if($numArray[$j]< $numArray[$j+1]){
$aa = $numArray[$j+1];
$numArray[$j+1]=$numArray[$j];
$numArray[$j]=$aa;
}
}
}
print_r($numArray);
?>