(PHP 5 >= 5.1.0)
LimitIterator::__construct — Construit un nouvel objet LimitIterator
Construit un nouvel objet LimitIterator,depuis iterator avec un offset et une limite maximum count
L'Iterator à limiter.
Position optionnelle de la limite.
Nombre optionnelle de la limite.
Le nouvel objet LimitIterator.
Envoie une OutOfRangeException si offset est inférieur à 0 ou si count est inférieur à -1.
Exemple #1 Exemple LimitIterator::__construct()
<?php
$ait = new ArrayIterator(array('a', 'b', 'c', 'd', 'e'));
$lit = new LimitIterator($ait, 1, 3);
foreach ($lit as $value) {
echo $value . "\n";
}
?>
L'exemple ci-dessus va afficher :
b c d