Home  >  Article  >  Backend Development  >  php 冒泡排序 交换排序法_PHP

php 冒泡排序 交换排序法_PHP

WBOY
WBOYOriginal
2016-06-01 12:16:49734browse
复制代码 代码如下:
$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