summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_024.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/closure_024.phpt')
-rw-r--r--Zend/tests/closure_024.phpt26
1 files changed, 26 insertions, 0 deletions
diff --git a/Zend/tests/closure_024.phpt b/Zend/tests/closure_024.phpt
new file mode 100644
index 0000000..74083f7
--- /dev/null
+++ b/Zend/tests/closure_024.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Closure 024: Clone the Closure object
+--FILE--
+<?php
+
+$a = 1;
+$c = function($add) use(&$a) { return $a+$add; };
+
+$cc = clone $c;
+
+echo $c(10)."\n";
+echo $cc(10)."\n";
+
+$a++;
+
+echo $c(10)."\n";
+echo $cc(10)."\n";
+
+echo "Done.\n";
+?>
+--EXPECTF--
+11
+11
+12
+12
+Done. \ No newline at end of file