b59f21c960e76612ae1fa8cb32c3881319c32bb2
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
21 $GLOBALS["dir"] = $dir; // Direction, a positive number for ascending a negative for descending
27 function comp2($a,$b,$i = 0) {
31 if ($a["$col[$i]"] == $b["$col[$i]"]){
33 while($i < $c && $r == 0){
37 } elseif($a["$col[$i]"] < $b["$col[$i]"]){
38 $r = -1 * $dir; // Im not sure why you must * dir here, but it wont work just before the return...
45 function removeElement($array, $element) {
47 for ($i = 0;$i < count($array);$i++
)
49 $newArray[$j] = $array[$i];
56 function array_cleave($array1, $column)
60 while ($key < count($array1)) {
61 array_push($array2, $array1[$key]["$column"]);