<?php function func(callable $callback) { echo "callback..."; call_user_func($callback); } class Hoge { private function fuga() { echo "fuga!"; } } $hoge = new Hoge(); func(array($hoge, "fuga"));
¢¬¤Ê´¶¤¸¤Çcallable ¥¿¥¤¥×¥Ò¥ó¥Æ¥£¥ó¥°¤ò»ÈÍѤ·¤Æ¤ß¤¿¤È¤³¤í¡¢
Catchable fatal error: Argument 1 passed to func() must be callable, array given, called in /path/to/callable.php on line 13 and defined in /path/to/callable.php on line 3
¤Ã¤ÆÅܤé¤ì¡¢callable ¥¿¥¤¥×¥Ò¥ó¥Æ¥£¥ó¥°¤Ê¤ó¤Æ½é¤á¤Æ»È¤Ã¤¿¤Î¤Ç¡¢
¡Ö¤ª¤¤¤ª¤¤¡¢ÇÛÎó»ØÄê¤Ï»È¤¨¤Ê¤¤¤ó¤¸¤ã¤Ê¤¤¤«¤è¤Ã¡×
¤Ã¤È¡¢ºá¤â¤Ê¤¤¥Í¥¿¸µ¥µ¥¤¥È¤òµ¿¤Ã¤Æ¤·¤Þ¤Ã¤¿m(_ _;)m
¤³¤Î¥¨¥é¡¼¤Î¸¶°ø¤Ï¡¢¥¿¥¤¥×¥Ò¥ó¥Æ¥£¥ó¥°¤ò³°¤·¤¿¤é¤ï¤«¤Ã¤¿¡£
Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method Hoge::fuga() in...
¤¦¤à¡£fuga¥á¥½¥Ã¥É¤òpublic¤Ë¤·¤¿¤é¥¨¥é¡¼¤Ê¤¯Æ°¤¤Þ¤·¤¿¤È¤µ¡£
´Ä¶¤Ïphp5.6.3@win¤Ç¤·¤¿¡£´Ä¶¤Ë¤è¤Ã¤Æ¤Ï¤Á¤ã¤ó¤È»ØŦ¤·¤Æ¤¯¤ì¤ë¤Î¤«¤â¡£¡£