xref: /PHP-7.2/Zend/tests/foreach_009.phpt (revision 17ccbeec)
1--TEST--
2Nested foreach by reference and array modification with resize
3--FILE--
4<?php
5$a = [0, 1, 2, 3, 4, 5, 6, 7];
6unset($a[0], $a[1], $a[2], $a[3]);
7foreach ($a as &$ref) {
8	foreach ($a as &$ref2) {
9		echo "$ref-$ref2\n";
10		if ($ref == 5 && $ref2 == 6) {
11			$a[42] = 8;
12		}
13	}
14}
15?>
16--EXPECT--
174-4
184-5
194-6
204-7
215-4
225-5
235-6
245-7
255-8
266-4
276-5
286-6
296-7
306-8
317-4
327-5
337-6
347-7
357-8
368-4
378-5
388-6
398-7
408-8
41