- var_dump: documentation ( source)
<?php
$fruits = new ArrayIterator(array(
'apple',
'banana',
'cherry',
'orange',
'pear'
));
// Passing by the custom iterator only a substet of the elements
foreach (new IteratorIterator(new LimitIterator($fruits ,2, 2)) as $fruit) {
var_dump($fruit);
}