不使用php api函数实现数组的交换排序示例_php实例

WBOY
Release: 2016-06-07 17:20:36
Original
647 people have browsed it

复制代码 代码如下:

$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 "当前数组为:";print_r($arr);echo "
";
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template