static public function cpm_userinfo($a,$b){ //Compare two userinfo fields $field = self::$field; $adata = $a->userinfo->$field; $bdata = $b->userinfo->$field; if($adata == $bdata) { return self::cpm_userid($a,$b); } if(is_string($adata) && function_exists('collatorlib::compare')){ return (collatorlib::compare($adata, $bdata))*(self::$ascending); } if($adata < $bdata){ return self::$ascending; }else{ return -self::$ascending; } }
/** * Returns: * 1 if str1 is greater than str2 * 0 if str1 is equal to str2 * -1 if str1 is less than str2 * * @param mixed $obja The first object to compare * @param mixed $objb The second object to compare * @return int */ public function compare($obja, $objb) { $resulta = $obja->{$this->method}(); $resultb = $objb->{$this->method}(); return collatorlib::compare($resulta, $resultb); }