1--TEST-- 2SPL: IteratorIterator and ArrayIterator/Object 3--FILE-- 4<?php 5 6class ArrayIteratorEx extends ArrayIterator 7{ 8 function rewind() 9 { 10 echo __METHOD__ . "\n"; 11 return parent::rewind(); 12 } 13} 14 15$it = new ArrayIteratorEx(range(0,3)); 16 17foreach(new IteratorIterator($it) as $v) 18{ 19 var_dump($v); 20} 21 22class ArrayObjectEx extends ArrayObject 23{ 24 function getIterator() 25 { 26 echo __METHOD__ . "\n"; 27 return parent::getIterator(); 28 } 29} 30 31$it = new ArrayObjectEx(range(0,3)); 32 33foreach(new IteratorIterator($it) as $v) 34{ 35 var_dump($v); 36} 37 38?> 39===DONE=== 40<?php exit(0); ?> 41--EXPECTF-- 42ArrayIteratorEx::rewind 43int(0) 44int(1) 45int(2) 46int(3) 47ArrayObjectEx::getIterator 48int(0) 49int(1) 50int(2) 51int(3) 52===DONE=== 53