a64eb60779d60515a5381ed635a3031abb4ee558
5 ** This contains functions that work with array manipulation. They
6 ** will help sort, and do other types of things with arrays
13 function ary_sort($ary,$col, $dir = 1){
14 // The globals are used because USORT determines what is passed to comp2
15 // These should be $this->col and $this->dir in a class
16 // Would beat using globals
20 $GLOBALS['col'] = $col; // Column or Columns as an array
25 $GLOBALS['dir'] = $dir; // Direction, a positive number for ascending a negative for descending
27 usort($ary,'array_comp2');
31 function array_comp2($a,$b,$i = 0) {
35 if ($a[$col[$i]] == $b[$col[$i]]){
37 while($i < $c && $r == 0){
41 } elseif($a[$col[$i]] < $b[$col[$i]]){
47 function removeElement($array, $element) {
49 for ($i = 0;$i < count($array);$i++
)
51 $newArray[$j] = $array[$i];
58 function array_cleave($array1, $column)
62 while ($key < count($array1)) {
63 array_push($array2, $array1[$key][$column]);