I am trying to imitate the built-in function definition of the usr function in my implementation below:
class heapSort { static function hsort(array &$array, callable $cmp_function){ // logic } } class utility{ static function mycomparator(){ // logic } } $array = array(5,3,8,1); $callback = array('utility','mycomparator'); heapSort::hsort($array, $callback);
While the $callback variable is "callable", why am I getting below a fatal error?
Argument 2 passed to heapSort :: hsort () must be an instance of the called.
In particular, how do I make / typecast a $variable to call?
source share