xref: /PHP-8.0/Zend/tests/foreach_010.phpt (revision f8d79582)
1--TEST--
2Nested foreach by value over object and object modification with resize
3--FILE--
4<?php
5$o = (object)['a'=>0, 'b'=>1, 'c'=>2, 'd'=>3, 'e'=>4, 'f'=>5, 'g'=>6, 'h'=>7];
6unset($o->a, $o->b, $o->c, $o->d);
7foreach ($o as $v1) {
8    foreach ($o as $v2) {
9        echo "$v1-$v2\n";
10        if ($v1 == 5 && $v2 == 6) {
11            $o->i = 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