18d0e83baba4389ba3836d6ded1cac3d72d55a14
2 function ary_sort($ary,$col, $dir = 1){
3 // The globals are used because USORT determines what is passed to comp2
4 // These should be $this->col and $this->dir in a class
5 // Would beat using globals
9 $GLOBALS["col"] = $col; // Column or Columns as an array
10 $GLOBALS["dir"] = $dir; // Direction, a positive number for ascending a negative for descending
12 function comp2($a,$b,$i = 0) {
16 if ($a["$col[$i]"] == $b["$col[$i]"]){
18 while($i < $c && $r == 0){
22 } elseif($a["$col[$i]"] < $b["$col[$i]"]){
23 $r = -1 * $dir; // Im not sure why you must * dir here, but it wont work just before the return...