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