Iterator
An iterator is an object which can be traversed with a foreach() loop.
Iterator is an interface, which shall be implemented by objects. There are also a list of default iterators in the SPL extension.
An iterator may be turned into an array, with the iterator_to_array() function. Arrays may be used as iterator natively, or used as an object with the ArrayObject class.
<?php
class myIterator implements Iterator { /**/ }
$it = new myIterator;
foreach($it as $key => $value) {
var_dump($key, $value);
echo "\n";
}
?>