xref: /PHP-7.1/ext/spl/tests/iterator_071.phpt (revision 113213f0)
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() {
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--EXPECTF--
25MyRecursiveIteratorIterator::nextelement
260
27MyRecursiveIteratorIterator::nextelement
281
29MyRecursiveIteratorIterator::nextelement
300
31MyRecursiveIteratorIterator::nextelement
321
33