(PHP 5 >= 5.1.0, PHP 7)
Examples:
LimitIterator usage example
<?php

// Create an iterator to be limited
$fruits = new ArrayIterator(array(
    'apple',
    'banana',
    'cherry',
    'damson',
    'elderberry'
));

// Loop over first three fruits only
foreach (new LimitIterator($fruits, 0, 3) as $fruit) {
    var_dump($fruit);
}

echo "\n";

// Loop from third fruit until the end
// Note: offset starts from zero for apple
foreach (new LimitIterator($fruits, 2) as $fruit) {
    var_dump($fruit);
}

?>

The above example will output:

string(5) "apple"
string(6) "banana"
string(6) "cherry"

string(6) "cherry"
string(6) "damson"
string(10) "elderberry"
LimitIterator::__construct

(PHP 5 >= 5.1.0, PHP 7) Construct a LimitIterator

2016-02-24 16:19:56
LimitIterator::next

(PHP 5 >= 5.1.0, PHP 7) Move the iterator forward

2016-02-24 16:19:57
LimitIterator::valid

(PHP 5 >= 5.1.0, PHP 7) Check whether the current element is valid

2016-02-24 16:19:57
LimitIterator::seek

(PHP 5 >= 5.1.0, PHP 7) Seek to the given position

2016-02-24 16:19:57
LimitIterator::getPosition

(PHP 5 >= 5.1.0, PHP 7) Return the current position

2016-02-24 16:19:56
LimitIterator::key

(PHP 5 >= 5.1.0, PHP 7) Get current key public

2016-02-24 16:19:56
LimitIterator::current

(PHP 5 >= 5.1.0, PHP 7) Get current element

2016-02-24 16:19:56
LimitIterator::getInnerIterator

(PHP 5 >= 5.1.0, PHP 7) Get inner iterator

2016-02-24 16:19:56
LimitIterator::rewind

(PHP 5 >= 5.1.0, PHP 7) Rewind the iterator to the specified starting offset

2016-02-24 16:19:57