5 * This contains functions that work with array manipulation. They
6 * will help sort, and do other types of things with arrays
12 function ary_sort($ary,$col, $dir = 1){
13 // The globals are used because USORT determines what is passed to comp2
14 // These should be $this->col and $this->dir in a class
15 // Would beat using globals
19 $GLOBALS['col'] = $col; // Column or Columns as an array
24 $GLOBALS['dir'] = $dir; // Direction, a positive number for ascending a negative for descending
26 usort($ary,'array_comp2');
30 function array_comp2($a,$b,$i = 0) {
34 if ($a[$col[$i]] == $b[$col[$i]]){
36 while($i < $c && $r == 0){
40 } elseif($a[$col[$i]] < $b[$col[$i]]){
46 function removeElement($array, $element) {
48 for ($i = 0;$i < count($array);$i++
)
50 $newArray[$j] = $array[$i];
57 function array_cleave($array1, $column)
61 while ($key < count($array1)) {
62 array_push($array2, $array1[$key][$column]);