LimitIterator::__construct
(PHP 5 >= 5.1.0)
LimitIterator::__construct — Construit un nouvel objet LimitIterator
Description
Construit un nouvel objet LimitIterator,depuis iterator avec
un offset et une limite maximum count
Liste de paramètres
-
iterator -
L'Iterator à limiter.
-
offset -
Position optionnelle de la limite.
-
count -
Nombre optionnelle de la limite.
Valeurs de retour
Le nouvel objet LimitIterator.
Erreurs / Exceptions
Envoie une OutOfRangeException
si offset est inférieur à 0
ou si count est inférieur à -1.
Exemples
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
