표준 PHP 라이브러리(SPL) SplObjectStorage::next

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

SplObjectStorage::next — 다음 항목으로 이동


설명

public SplObjectStorage::next(): void

반복자를 저장소의 다음 개체로 이동합니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

값이 반환되지 않습니다.


Examples

예제 #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(); // similar to current($s)

    var_dump($index);
    var_dump($object);
    $s->next();
}
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

int(0)
object(stdClass)#2 (0) {
}
int(1)
object(stdClass)#3 (0) {
}
                

기타