Home >Backend Development >PHP Tutorial >php冒泡排序函数

php冒泡排序函数

WBOY
WBOYOriginal
2016-06-23 13:38:351039browse

$arr=array(23,5,26,4,9,85,10,2,55,44,21,39,11,16,55,88,421,226,588);function maopao($arr,$value){//$value 1:从小到大的标志  2:从大到小的标志	$n=count($arr);	for($h=0;$h$arr[$i+1]){					$kong=$arr[$i+1];					$arr[$i+1]=$arr[$i];					$arr[$i]=$kong;				}			}else{//从大到小				if($arr[$i]  <br> 
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