php-src/ext/spl/examples/seekableiterator.inc

16 lines
233 B
PHP
Raw Normal View History

<?php
class SeekableIterator implements Iterator
{
function seek($index) {
$this->rewind();
$position = 0;
while($position < $index && $this->it->hasMore()) {
$this->next();
$position++;
}
return $position;
}
}
?>