PHP 实现冒泡排序
直接上代码
//冒泡排序
function bubble_sort($array){$count = count($array);if ($count<=0) {return false;}for ($i=0; $i <$count ; $i++) { for ($j=0; $j <$count-$i-1 ; $j++) { if ($array[$j]>$array[$j+1]) {$tmp = $array[$j+1];$array[$j+1]=$array[$j];$array[$j]=$tmp;}}}return $array;}