Copy code The code is as follows:
$arr = array(900, 20, 16, 50, -2, 10, 3);
$min = $max = 0;
for ($j=0;$j for ($i=0;$i if($arr[$i] > $arr[$i+1]){
$min = $arr[$i+1];
$arr[$i+1] = $arr [$i];
$arr[$i] = $min;
}
}
echo "The current array is:";print_r($arr);echo "
}
http://www.bkjia.com/PHPjc/754034.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/754034.htmlTechArticleCopy the code code as follows: $arr = array(900, 20, 16, 50, -2, 10, 3 ); $min = $max = 0; for ($j=0;$jcount($arr);$j++){ for($i=0;$icount($arr)-1;$i++){ if( $arr[$i] $arr[$i+1]){...