diff options
Diffstat (limited to 'ext/spl/examples/seekableiterator.inc')
| -rwxr-xr-x | ext/spl/examples/seekableiterator.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/spl/examples/seekableiterator.inc b/ext/spl/examples/seekableiterator.inc new file mode 100755 index 0000000000..157d2736f4 --- /dev/null +++ b/ext/spl/examples/seekableiterator.inc @@ -0,0 +1,16 @@ +<?php + +class SeekableIterator implements Iterator +{ + function seek($index) { + $this->rewind(); + $position = 0; + while($position < $index && $this->it->hasMore()) { + $this->next(); + $position++; + } + return $position; + } +} + +?>
\ No newline at end of file |
