5 ** Copyright (c) 1999-2001 The Squirrelmail Development Team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** This contains functions that work with array manipulation. They
9 ** will help sort, and do other types of things with arrays
15 function ary_sort($ary,$col, $dir = 1){
16 // The globals are used because USORT determines what is passed to comp2
17 // These should be $this->col and $this->dir in a class
18 // Would beat using globals
22 $GLOBALS['col'] = $col; // Column or Columns as an array
27 $GLOBALS['dir'] = $dir; // Direction, a positive number for ascending a negative for descending
29 usort($ary,'array_comp2');
33 function array_comp2($a,$b,$i = 0) {
37 if ($a[$col[$i]] == $b[$col[$i]]){
39 while($i < $c && $r == 0){
43 } elseif($a[$col[$i]] < $b[$col[$i]]){
49 function removeElement($array, $element) {
51 for ($i = 0;$i < count($array);$i++
)
53 $newArray[$j] = $array[$i];
60 function array_cleave($array1, $column)
64 while ($key < count($array1)) {
65 array_push($array2, $array1[$key][$column]);