Help me please:
class xam{
public static function __callStatic($name, $arguments) {
self::$name();
}
static protected function mycallback(){
echo 'mycallback';
}
}
function doIt($callback) { $callback(); }
I am trying:
doIt(xam::mycallback);
Error:
Fatal error: Undefined class constant 'mycallback'
I know one variant:
doIt(function(){xam::mycallback();});
But it may have an alternative ? Thanks for your help .
You can specify the callback as the string
"xam::mycallback"
or array['xam', 'mycallback']
. The manual describes all the options for specifying callables.Try using this...