静的関数を変数に割り当てる方法、またはこれを他の方法で実行する方法はありますか?
class my_class{
public static function my_method($a){
return $a;
}
}
$some_func = my_class::my_method;
$someAnonFunc = function($a) use ($some_func){
return $some_func($a);
}
$inst = new SomeOtherClass(); //Defined somewhere else, in some other file
$inst->someMethod($a, $someAnonFunc);
この時点で、次のようになります。
致命的なエラー:未定義のクラス定数'my_method'