Is it possible to access the parent class's methods in this scenario, using usort()
?
class MyClass {
public function isGreater($old,$new){
return ($new - old > 0) ? true : false;
}
public function load($data){
usort($data,function($a,$b){
return $this->isGreater($a,$b) ? 1 : -1; // THIS IS THE PROBLEM LINE
}
}
}
I'm assuming since usort is using its own function scope, i can't access the public method isGreater()
. Is there any way to do this? I can turn that method into a static function if it helps...