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===DONE=== 24<?php exit(0); ?> 25--EXPECT-- 26==SECOND== 27int(1) 28array(3) { 29 [0]=> 30 int(21) 31 [1]=> 32 int(22) 33 [2]=> 34 array(1) { 35 [0]=> 36 int(231) 37 } 38} 39int(2) 40array(1) { 41 [0]=> 42 int(231) 43} 44===DONE=== 45