xref: /PHP-8.1/Zend/tests/foreach_008.phpt (revision f8d79582)
1--TEST--
2Nested foreach by reference and array modification
3--FILE--
4<?php
5$a = [0, 1, 2, 3];
6foreach ($a as &$x) {
7    foreach ($a as &$y) {
8        echo "$x - $y\n";
9        if ($x == 0 && $y == 1) {
10            unset($a[2]);
11            unset($a[1]);
12        }
13    }
14}
15?>
16--EXPECT--
170 - 0
180 - 1
190 - 3
203 - 0
213 - 3
22