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
20 $GLOBALS["dir"] = $dir; // Direction, a positive number for ascending a negative for descending
26 function comp2($a,$b,$i = 0) {
30 if ($a["$col[$i]"] == $b["$col[$i]"]){
32 while($i < $c && $r == 0){
36 } elseif($a["$col[$i]"] < $b["$col[$i]"]){
37 $r = -1 * $dir; // Im not sure why you must * dir here, but it wont work just before the return...
44 function removeElement($array, $element) {
46 for ($i = 0;$i < count($array);$i++
)
48 $newArray[$j] = $array[$i];