Hi,

Is it possible to have the compare function in a class? I can not get it to
work, this is pseudo code:

class A {
   function getArray() {
      //dosomethingandgetanarray
      $array = blabla;
      usort($array, "$this->myCompareFunction"); 
      //Or maybe "A::myCompareFunction"
   }

   function myCompareFunction($a, $b) {
      //return rajraj depending on $a and $b values
   }
}


Right now I have keep the compare function outside of the class like this:

class A {
   function getArray() {
      //dosomethingandgetanarray
      $array = blabla;
      usort($array, "$this->myCompareFunction");
   }
}

function myCompareFunction($a, $b) {
   //return rajraj depending on $a and $b values
}

Best regards,
Peter Lauri

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to