xref: /PHP-7.2/ext/spl/tests/iterator_040.phpt (revision 610c7fbe)
1--TEST--
2SPL: RecursiveFilterIterator
3--FILE--
4<?php
5
6class MyRecursiveFilterIterator extends RecursiveFilterIterator
7{
8	function accept()
9	{
10		return true;
11	}
12}
13
14$ar = array(1, array(21, 22), 3);
15$it = new RecursiveArrayIterator($ar);
16$it = new MyRecursiveFilterIterator($it);
17$it = new RecursiveIteratorIterator($it);
18
19foreach($it as $k => $v)
20{
21	echo "===\n";
22	var_dump($it->getDepth());
23	var_dump($k);
24	var_dump($v);
25}
26
27?>
28===DONE===
29<?php exit(0); ?>
30--EXPECT--
31===
32int(0)
33int(0)
34int(1)
35===
36int(1)
37int(0)
38int(21)
39===
40int(1)
41int(1)
42int(22)
43===
44int(0)
45int(2)
46int(3)
47===DONE===
48