<?php //OuterIterator.php
$array = ['value1','value2','value3','value4'];
$outerObj = new OuterImpl(new ArrayIterator($array));
foreach ($outerObj as $key => $value){
echo "++".$key."---".$value."<br />";
}
class OuterImpl extends ArrayIterator
{
public function current(){
return parent::current()."_tail";
}
public function key(){
return "Pre_".parent::key();
}
?>
单色彩虹