function order($a) {
$len = count($a); for($i = 0; $i <= $len; $i++) { for($j = $len-1; $j > $i; $j--) { echo '【' , $i , '】'; echo "<hr />"; echo $j; echo ''; if($a[$j] > $a[$j-1]) { echo "++"; $x = $a[$j]; $a[$j] = $a[$j-1]; $a[$j-1] = $x; } } } return $a; }$a = array(11,34,2,10,56,78,100,3,6);
print_r(order($a));