回答編集履歴
5
修正
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
$closure = $
|
49
|
+
$closure = $method->getClosure();
|
50
50
|
|
51
51
|
$closure(); // Hello
|
52
52
|
|
4
完成
test
CHANGED
@@ -34,15 +34,15 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
-
$
|
37
|
+
$method = new ReflectionMethod('Example', 'hello');
|
38
38
|
|
39
|
-
$
|
39
|
+
$method->invoke(null); // Hello
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
-
$
|
43
|
+
$method = new ReflectionMethod('Example::hello');
|
44
44
|
|
45
|
-
$
|
45
|
+
$method->invoke(null); // Hello
|
46
46
|
|
47
47
|
|
48
48
|
|
3
a
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
$callable = 'Example::hello';
|
32
32
|
|
33
|
-
$callable(); // Hello
|
33
|
+
$callable(); // Hello (PHP7.0以降のみ)
|
34
34
|
|
35
35
|
|
36
36
|
|
2
a
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
$closure = $func->getClosure()
|
49
|
+
$closure = $func->getClosure();
|
50
50
|
|
51
51
|
$closure(); // Hello
|
52
52
|
|
1
a
test
CHANGED
@@ -46,6 +46,10 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
+
$closure = $func->getClosure()
|
50
|
+
|
51
|
+
$closure(); // Hello
|
52
|
+
|
49
|
-
$
|
53
|
+
$closure->__invoke(); // Hello
|
50
54
|
|
51
55
|
```
|