summaryrefslogtreecommitdiff
path: root/Zend/tests/foreach_012.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/foreach_012.phpt')
-rw-r--r--Zend/tests/foreach_012.phpt18
1 files changed, 18 insertions, 0 deletions
diff --git a/Zend/tests/foreach_012.phpt b/Zend/tests/foreach_012.phpt
new file mode 100644
index 0000000000..5e5538cd4d
--- /dev/null
+++ b/Zend/tests/foreach_012.phpt
@@ -0,0 +1,18 @@
+--TEST--
+array_walk() function precerve foreach by reference iterator pointer
+--FILE--
+<?php
+$a = [1,2,3,4,5];
+foreach($a as &$v) {
+ echo "$v\n";
+ if ($v == 3) {
+ array_walk($a, function (&$x) {$x+=10;});
+ }
+}
+?>
+--EXPECT--
+1
+2
+3
+14
+15 \ No newline at end of file