$arr=array(10,3,1,8);
function bubble(&$arr){
$total=count($arr);
for($i=0;$i<$total - 1;$i ){
for($j=0;$total - 1 - $i;$ [$j] > $arr[$j 1]){
$temp=$arr[$j];
與$ arr [$j 1]=$temp;
}
}
echo '
';
}
}
bubble($arr);
echo '<br>';
print_r($arr);
?>