Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

limititerator(3) [php man page]

LIMITITERATOR(3)							 1							  LIMITITERATOR(3)

The LimitIterator class

INTRODUCTION
The LimitIterator class allows iteration over a limited subset of items in an Iterator. CLASS SYNOPSIS
LimitIterator LimitIteratorextends IteratorIteratorOuterIterator Methods o public LimitIterator::__construct (Iterator $iterator, [int $offset], [int $count = -1]) o public mixed LimitIterator::current (void ) o public Iterator LimitIterator::getInnerIterator (void ) o public int LimitIterator::getPosition (void ) o public mixed LimitIterator::key (void ) o public void LimitIterator::next (void ) o public void LimitIterator::rewind (void ) o public int LimitIterator::seek (int $position) o public bool LimitIterator::valid (void ) EXAMPLES
Example #1 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 " "; // 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" PHP Documentation Group LIMITITERATOR(3)

Check Out this Related Man Page

RECURSIVEARRAYITERATOR(3)						 1						 RECURSIVEARRAYITERATOR(3)

The RecursiveArrayIterator class

INTRODUCTION
This iterator allows to unset and modify values and keys while iterating over Arrays and Objects in the same way as the ArrayIterator. Additionally it is possible to iterate over the current iterator entry. CLASS SYNOPSIS
RecursiveArrayIterator RecursiveArrayIteratorextends ArrayIteratorRecursiveIterator Methods o public RecursiveArrayIterator RecursiveArrayIterator::getChildren (void ) o public bool RecursiveArrayIterator::hasChildren (void ) Inherits o public void ArrayIterator::append (mixed $value) o public void ArrayIterator::asort (void ) o public ArrayIterator::__construct ([mixed $array = array()], [int $flags]) o public int ArrayIterator::count (void ) o public mixed ArrayIterator::current (void ) o public array ArrayIterator::getArrayCopy (void ) o public void ArrayIterator::getFlags (void ) o public mixed ArrayIterator::key (void ) o public void ArrayIterator::ksort (void ) o public void ArrayIterator::natcasesort (void ) o public void ArrayIterator::natsort (void ) o public void ArrayIterator::next (void ) o public void ArrayIterator::offsetExists (string $index) o public mixed ArrayIterator::offsetGet (string $index) o public void ArrayIterator::offsetSet (string $index, string $newval) o public void ArrayIterator::offsetUnset (string $index) o public void ArrayIterator::rewind (void ) o public void ArrayIterator::seek (int $position) o public string ArrayIterator::serialize (void ) o public void ArrayIterator::setFlags (string $flags) o public void ArrayIterator::uasort (string $cmp_function) o public void ArrayIterator::uksort (string $cmp_function) o public string ArrayIterator::unserialize (string $serialized) o public bool ArrayIterator::valid (void ) PHP Documentation Group RECURSIVEARRAYITERATOR(3)
Man Page