multiSort Class Reference

List of all members.

Public Member Functions

Private Member Functions


Detailed Description

Definition at line 29 of file multiSort.php.


Constructor & Destructor Documentation

multiSort::__construct (  ) 

Definition at line 31 of file multiSort.php.

00031                                {
00032   }


Member Function Documentation

multiSort::_uasort ( array,
func,
param 
) [private]

Definition at line 48 of file multiSort.php.

Referenced by sortArray().

00048                                                 {
00049     for($i=0;$i<sizeof($array);$i++) {
00050       $tmp = $i;
00051       for($j=1;$j<sizeof($array);$j++) {
00052         $result = $this->$func($array[$tmp],$array[$j],$param);
00053         if($result == -1) {
00054           $array = $this->arraySwap($array,$tmp,$j);
00055           $tmp = $j;
00056         }
00057       }
00058     }
00059     return $array;
00060   }

multiSort::arrayswap ( arr,
src,
dst 
) [private]

Definition at line 62 of file multiSort.php.

00062                                                {
00063     $tmp = $arr[$dst];
00064     $arr[$dst] = $arr[$src];
00065     $arr[$src] = $tmp;
00066     return $arr;
00067   }

multiSort::asc ( a,
b,
p 
) [private]

Definition at line 36 of file multiSort.php.

00036                                     {
00037     $resa=(is_array($a))? $a[$p] : $a->$p;
00038     $resb=(is_array($b))? $b[$p] : $b->$p;
00039     return (strcmp ($resa,$resb));
00040   }

multiSort::desc ( a,
b,
p 
) [private]

Definition at line 42 of file multiSort.php.

00042                                      {
00043     $resa=(is_array($a))? $a[$p] : $a->$p;
00044     $resb=(is_array($b))? $b[$p] : $b->$p;
00045     return -1 * (strcmp ($resa,$resb));
00046     }

multiSort::sortArray ( array,
parameter,
_function = 'asc' 
)

Definition at line 34 of file multiSort.php.

00034 { return $this->_uasort($array,$_function,$parameter); }


The documentation for this class was generated from the following file: