L'interface IteratorAggregate
Introduction
Interface pour cr�er un it�rateur externe.
Sommaire de l'Interface
Exemple #1 Exemple simple
<?php
class myData implements IteratorAggregate {
public $property1 = "Propri�t� publique num�ro un";
public $property2 = "Propri�t� publique num�ro deux";
public $property3 = "Propri�t� publique num�ro trois";
public function __construct() {
$this->property4 = "derni�re propri�t�";
}
public function getIterator() {
return new ArrayIterator($this);
}
}
$obj = new myData;
foreach($obj as $key => $value) {
var_dump($key, $value);
echo "\n";
}
?>
L'exemple ci-dessus va afficher quelque chose de similaire � :
string(9) "property1" string(19) "Propri�t� publique num�ro un" string(9) "property2" string(19) "Propri�t� publique num�ro deux" string(9) "property3" string(21) "Propri�t� publique num�ro trois" string(9) "property4" string(13) "derni�re propri�t�"
Sommaire
- IteratorAggregate::getIterator ? Retourne un it�rateur externe