回答編集履歴
1
引用部分を修正
answer
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
[無名関数](http://php.net/manual/ja/functions.anonymous.php)のサンプルにある通り呼び出しかたが違うようです。
|
2
2
|
|
3
3
|
```PHP
|
4
|
+
$obj->func = function(){
|
5
|
+
echo "hello";
|
6
|
+
};
|
7
|
+
|
4
8
|
//$obj->func(); // doesn't work! php tries to match an instance method called "func" that is not defined in the original class' signature
|
5
9
|
|
6
10
|
// you have to do this instead:
|