额,一段代码
2014-3-1 18:07 Saturday  

分类: PHP 评论(71) 浏览(22734)

//娱乐
        $a = array(11,22,3523,45,24,564,55,34,56423,5,34,654,4);
        $count = count($a);

        for($i=0;$i<$count;$i++){
            $min = $a[$i];
            $mink = $i;
            for($k=$i+1;$k<$count;$k++){
                if($a[$k]<$min){
                    $min = $a[$k];
                    $mink = $k;
                }
            }
            $temp = $a[$i];
            $a[$i] = $min;
            $a[$mink] = $temp;
        }
        print_r($a);

+1 8

留下你的看法: