Applied patch #102655. Ha! my first commit !
[squirrelmail.git] / functions / array.php
index 049f63ca56b89abe0ba740ab97c85d211a59554c..9e83a19532ba2c4b34bf017a41914341d158e685 100644 (file)
@@ -1,12 +1,14 @@
-<?
+<?php
    /**
-    **  array.php3
+    **  array.php
     **
     **  This contains functions that work with array manipulation.  They
     **  will help sort, and do other types of things with arrays
     **
     **/
 
+   $array_php = true;
+
    function ary_sort($ary,$col, $dir = 1){
       // The globals are used because USORT determines what is passed to comp2
       // These should be $this->col and $this->dir in a class
       }
       $GLOBALS["col"] = $col;  // Column or Columns as an array
       $GLOBALS["dir"] = $dir;  // Direction, a positive number for ascending a negative for descending
-  
-      function comp2($a,$b,$i = 0) {
+
+      usort($ary,comp2);
+      return $ary;
+  }
+
+  function comp2($a,$b,$i = 0) {
          global $col;
          global $dir;
          $c = count($col) -1;
          }
          return $r;
       }
-  
-      usort($ary,comp2);
-      return $ary;
+
+   function removeElement($array, $element) {
+      $j = 0;
+      for ($i = 0;$i < count($array);$i++)
+         if ($i != $element) {
+            $newArray[$j] = $array[$i];
+            $j++;
+         }
+
+      return $newArray;
    }
+
+  function array_cleave($array1, $column)
+  {
+    $key=0;
+    $array2 = array();
+    while ($key < count($array1)) {
+        array_push($array2, $array1[$key]["$column"]);
+        $key++;
+    }
+
+    return ($array2);
+  }
+
 ?>