Keys →
Functions ↓
function sorter ( &$a, $k, $asc=true, $icase=true ) {#-k string sort array#- crude sort of an array by key; array structure is array[0:n]['key']#- $icase = true to ignore case (default) $cnt = count($a)-1; $change = true; while ($change and ($cnt > 0)) { $change = false; for ($i=0;$i<=$cnt-1;$i++) { $swap = false; if ( $asc and ( $icase) and (strtolower($a[$i][$k]) > strtolower($a[$i+1][$k]))) { $swap = true; } else if ( $asc and (!$icase) and ($a[$i][$k] > $a[$i+1][$k])) { $swap = true; } else if (!$asc and ( $icase) and (strtolower($a[$i][$k]) < strtolower($a[$i+1][$k]))) { $swap = true; } else if (!$asc and (!$icase) and ($a[$i][$k] < $a[$i+1][$k])) { $swap = true; } if ($swap) { #swap $junk = $a[$i]; $a[$i] = $a[$i+1]; $a[$i+1] = $junk; $change = true; } } $cnt--; } return $a; }?>