xref: /PHP-8.0/ext/spl/tests/iterator_033.phpt (revision f8d79582)
1--TEST--
2SPL: ParentIterator
3--FILE--
4<?php
5
6$it = new ParentIterator(new RecursiveArrayIterator(array(1,array(21,22, array(231)),3)));
7
8foreach(new RecursiveIteratorIterator($it) as $k=>$v)
9{
10    var_dump($k);
11    var_dump($v);
12}
13
14echo "==SECOND==\n";
15
16foreach(new RecursiveIteratorIterator($it, 1) as $k=>$v)
17{
18    var_dump($k);
19    var_dump($v);
20}
21
22?>
23--EXPECT--
24==SECOND==
25int(1)
26array(3) {
27  [0]=>
28  int(21)
29  [1]=>
30  int(22)
31  [2]=>
32  array(1) {
33    [0]=>
34    int(231)
35  }
36}
37int(2)
38array(1) {
39  [0]=>
40  int(231)
41}
42