SplObjectStorage::next
(PHP 5 >= 5.1.0, PHP 7)
SplObjectStorage::next — 次のエントリに移動する
説明
public SplObjectStorage::next ( ) : void
イテレータを、ストレージ内の次のオブジェクトに移動します。
パラメータ
この関数にはパラメータはありません。
返り値
値を返しません。
例
例1 SplObjectStorage::next() の例
<?php$s = new SplObjectStorage();$o1 = new StdClass;$o2 = new StdClass;$s->attach($o1, "d1");$s->attach($o2, "d2");$s->rewind();while($s->valid()) { $index = $s->key(); $object = $s->current(); // current($s) と同等 var_dump($index); var_dump($object); $s->next();}?>
上の例の出力は、 たとえば以下のようになります。
int(0) object(stdClass)#2 (0) { } int(1) object(stdClass)#3 (0) { }