summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_013.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/closure_013.phpt')
-rw-r--r--Zend/tests/closure_013.phpt25
1 files changed, 25 insertions, 0 deletions
diff --git a/Zend/tests/closure_013.phpt b/Zend/tests/closure_013.phpt
new file mode 100644
index 0000000..72d2b3f
--- /dev/null
+++ b/Zend/tests/closure_013.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Closure 013: __invoke() on temporary result
+--FILE--
+<?php
+class Foo {
+ function __invoke() {
+ echo "Hello World!\n";
+ }
+}
+
+function foo() {
+ return function() {
+ echo "Hello World!\n";
+ };
+}
+$test = new Foo;
+$test->__invoke();
+$test = foo();
+$test->__invoke();
+$test = foo()->__invoke();
+?>
+--EXPECT--
+Hello World!
+Hello World!
+Hello World!