com php-src: Added new test: Zend/tests/foreach_008.p hpt
[email protected] (Rasmus Lerdorf)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 721fc9e80d2ee8f2cd79c8c3cdceffae2c72de92 Author: Dmitry Stogov <[email protected]> Thu, 29 Jan 2015 21:43:28 +0300 Parents: 15a23b1218b3e38630d677751a975907daa2cd54 Branches: dstogov-foreach Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=721fc9e80d2ee8f2cd79c8c3cdceffae2c72de92 Log: Added new test Changed paths: A Zend/tests/foreach_008.phpt Diff: diff --git a/Zend/tests/foreach_008.phpt b/Zend/tests/foreach_008.phpt new file mode 100644 index 0000000..c68bcd8 --- /dev/null +++ b/Zend/tests/foreach_008.phpt @@ -0,0 +1,21 @@ +--TEST-- +Nested foreach by reference and array modification +--FILE-- +<?php +$a = [0, 1, 2, 3]; +foreach ($a as &$x) { + foreach ($a as &$y) { + echo "$x - $y\n"; + if ($x == 0 && $y == 1) { + unset($a[2]); + unset($a[1]); + } + } +} +?> +--EXPECT-- +0 - 0 +0 - 1 +0 - 3 +3 - 0 +3 - 3