Home >php教程 >PHP源码 >经典冒泡排序

经典冒泡排序

PHP中文网
PHP中文网Original
2016-06-01 14:32:431042browse

php代码

<?php
/*
 * 冒泡排序
 */
 $arr = array(12,23,33,46,67,90,234,156,99,80);
 echo &#39;原数组:
&#39;;
 print_r($arr);
 echo &#39;

&#39;;
 
 $n = count($arr);
 echo "元素个数:
$n";
 echo &#39;

&#39;;
 
 for($i=0;$i<$n;$i++) {
 	for($j=0;$j

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
Previous article:PHP短信* Next article:PHP 自动检测编码转换