1--TEST-- 2SPL: RecursiveFilterIterator 3--FILE-- 4<?php 5 6class MyRecursiveFilterIterator extends RecursiveFilterIterator 7{ 8 function accept(): bool 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--EXPECT-- 29=== 30int(0) 31int(0) 32int(1) 33=== 34int(1) 35int(0) 36int(21) 37=== 38int(1) 39int(1) 40int(22) 41=== 42int(0) 43int(2) 44int(3) 45