function printarr($arr) { foreach ($arr as $k => $v) { if (is_array($v)) { printarr($v); } else { echo "<tr>\n\t<td>«{$k}»</td>\n\t<td>«" . htmlspecialchars($v, ENT_COMPAT, 'UTF-8') . "»</td>\n</tr>\n"; } } }
/** * prf * * Print $_FILES array * * @return void **/ function prf() { printarr($_FILES, '$_FILES:'); }
echo "<br>"; echo "k: "; for ($k = 0; $k < $i; $k++) { echo '[' . $k . ']'; if ($arr[$k + 1] < $arr[$k]) { $tmp = $arr[$k + 1]; $arr[$k + 1] = $arr[$k]; $arr[$k] = $tmp; } } echo "<br>"; print_r($arr); echo "<hr>"; } return $arr; } $arr = array(255, 1, 22, 3, 45, 5, 6); // print_r($arr); printarr($arr); $result = netbubbleSort($arr); $myresult = mybubbleSort($arr); // print_r($result); printarr($result); printarr($myresult); function printarr($a) { foreach ($a as $key => $value) { echo $value . "<br>"; } echo "<hr>"; }