Location: PHPKode > scripts > SPL and Iterators > spl-and-iterators/smartdir/array.php
<?php
$ar = array(0, 1, array(2, 3, array (5, 6)));

$iAr = new RecursiveArrayIterator ($ar);
foreach($iAr as $val)
{
    echo $val, '<br />';
}


$ar = array(0, 1, array(2, 3));

foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($ar)) as $val)
{
    echo "$val<br />";
}

?>
Return current item: SPL and Iterators