summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_009.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/closure_009.phpt')
-rw-r--r--Zend/tests/closure_009.phpt31
1 files changed, 31 insertions, 0 deletions
diff --git a/Zend/tests/closure_009.phpt b/Zend/tests/closure_009.phpt
new file mode 100644
index 0000000..5c576d7
--- /dev/null
+++ b/Zend/tests/closure_009.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Closure 009: Using static vars inside lambda
+--FILE--
+<?php
+$a = 1;
+$x = function ($x) use ($a) {
+ static $n = 0;
+ $n++;
+ $a = $n.':'.$a;
+ echo $x.':'.$a."\n";
+};
+$y = function ($x) use (&$a) {
+ static $n = 0;
+ $n++;
+ $a = $n.':'.$a;
+ echo $x.':'.$a."\n";
+};
+$x(1);
+$x(2);
+$x(3);
+$y(4);
+$y(5);
+$y(6);
+?>
+--EXPECT--
+1:1:1
+2:2:1
+3:3:1
+4:1:1
+5:2:1:1
+6:3:2:1:1