1--TEST--
2SPL: RecursiveTreeIterator
3--FILE--
4<?php
5
6$ary = array(
7    0 => array(
8        "a",
9        1,
10    ),
11    "a" => array(
12        2,
13        "b",
14        3 => array(
15            4,
16            "c",
17        ),
18        "3" => array(
19            4,
20            "c",
21        ),
22    ),
23);
24
25$it = new RecursiveArrayIterator($ary);
26echo "-- flags = BYPASS_KEY --\n";
27foreach(new RecursiveTreeIterator($it) as $k => $v) {
28    echo "[$k] => $v\n";
29}
30echo "-- flags = BYPASS_CURRENT --\n";
31foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT) as $k => $v) {
32    echo "[$k] => $v\n";
33}
34echo "-- flags = BYPASS_KEY|BYPASS_KEY --\n";
35foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT|RecursiveTreeIterator::BYPASS_KEY) as $k => $v) {
36    echo "[$k] => $v\n";
37}
38echo "-- flags = 0 --\n";
39foreach(new RecursiveTreeIterator($it, 0) as $k => $v) {
40    echo "[$k] => $v\n";
41}
42echo "-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --\n";
43foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $k => $v) {
44    echo "[$k] => $v\n";
45}
46
47?>
48--EXPECTF--
49-- flags = BYPASS_KEY --
50[0] => |-Array
51[0] => | |-a
52[1] => | \-1
53[a] => \-Array
54[0] =>   |-2
55[1] =>   |-b
56[3] =>   \-Array
57[0] =>     |-4
58[1] =>     \-c
59-- flags = BYPASS_CURRENT --
60
61Warning: Array to string conversion in %s on line %d
62[|-0] => Array
63[| |-0] => a
64[| \-1] => 1
65
66Warning: Array to string conversion in %s on line %d
67[\-a] => Array
68[  |-0] => 2
69[  |-1] => b
70
71Warning: Array to string conversion in %s on line %d
72[  \-3] => Array
73[    |-0] => 4
74[    \-1] => c
75-- flags = BYPASS_KEY|BYPASS_KEY --
76
77Warning: Array to string conversion in %s on line %d
78[0] => Array
79[0] => a
80[1] => 1
81
82Warning: Array to string conversion in %s on line %d
83[a] => Array
84[0] => 2
85[1] => b
86
87Warning: Array to string conversion in %s on line %d
88[3] => Array
89[0] => 4
90[1] => c
91-- flags = 0 --
92[|-0] => |-Array
93[| |-0] => | |-a
94[| \-1] => | \-1
95[\-a] => \-Array
96[  |-0] =>   |-2
97[  |-1] =>   |-b
98[  \-3] =>   \-Array
99[    |-0] =>     |-4
100[    \-1] =>     \-c
101-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --
102[|-0] => |-Array
103[| |-0] => | |-a
104[| \-1] => | \-1
105[\-a] => \-Array
106[  |-0] =>   |-2
107[  |-1] =>   |-b
108[  \-3] =>   \-Array
109[    |-0] =>     |-4
110[    \-1] =>     \-c
111