Home  >  Article  >  php教程  >  php 冒泡排序 交换排序法

php 冒泡排序 交换排序法

WBOY
WBOYOriginal
2016-06-13 12:09:43879browse

复制代码 代码如下:


$a=array('11','2','13','4','22');
$num = count($a);
for($i=0;$ifor($j=0;$jif($a[$i]$temp = $a[$i];
$a[$i]=$a[$j];
$a[$j]=$temp;
}
}
}
print_r($a);

Statement:
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