xref: /PHP-8.3/ext/spl/tests/iterator_071.phpt (revision b3e08881)
1--TEST--
2SPL: RecursiveIteratorIterator - Test where the case is RS_SELF and mode is CHILD_FIRST
3--FILE--
4<?php
5
6$arr = array(array(1,2),2);
7$arrOb = new ArrayObject($arr);
8
9$recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
10
11class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
12
13    function nextelement(): void {
14        echo __METHOD__."\n";
15    }
16}
17
18
19$recItIt = new MyRecursiveIteratorIterator($recArrIt, RecursiveIteratorIterator::CHILD_FIRST);
20
21foreach ($recItIt as $key => $val) echo "$key\n";
22
23?>
24--EXPECT--
25MyRecursiveIteratorIterator::nextelement
260
27MyRecursiveIteratorIterator::nextelement
281
29MyRecursiveIteratorIterator::nextelement
300
31MyRecursiveIteratorIterator::nextelement
321
33