표준 PHP 라이브러리(SPL) The RecursiveArrayIterator class
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
소개
이 반복기를 사용하면 ArrayIterator와 동일한 방식으로 배열 및 개체를 반복하면서 값과 키를 설정 해제하고 수정할 수 있습니다. 또한 현재 반복기 항목을 반복할 수 있습니다.
클래스 개요
class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator {
/* Inherited constants */
const int STD_PROP_LIST = 1;
const int ARRAY_AS_PROPS = 2;
/* Constants */
const int CHILD_ARRAYS_ONLY = 4;
/* Methods */
public getChildren(): ?RecursiveArrayIterator
public hasChildren(): bool
/* Inherited methods */
public ArrayIterator::append(mixed $value): void
public ArrayIterator::asort(int $flags = SORT_REGULAR): bool
public ArrayIterator::count(): int
public ArrayIterator::current(): mixed
public ArrayIterator::getArrayCopy(): array
public ArrayIterator::getFlags(): int
public ArrayIterator::key(): string|int|null
public ArrayIterator::ksort(int $flags = SORT_REGULAR): bool
public ArrayIterator::natcasesort(): bool
public ArrayIterator::natsort(): bool
public ArrayIterator::next(): void
public ArrayIterator::offsetExists(mixed $key): bool
public ArrayIterator::offsetGet(mixed $key): mixed
public ArrayIterator::offsetSet(mixed $key, mixed $value): void
public ArrayIterator::offsetUnset(mixed $key): void
public ArrayIterator::rewind(): void
public ArrayIterator::seek(int $offset): void
public ArrayIterator::serialize(): string
public ArrayIterator::setFlags(int $flags): void
public ArrayIterator::uasort(callable $callback): bool
public ArrayIterator::uksort(callable $callback): bool
public ArrayIterator::unserialize(string $data): void
public ArrayIterator::valid(): bool
}
미리 정의된 상수
RecursiveArrayIterator Flags
RecursiveArrayIterator::CHILD_ARRAYS_ONLY
- 재귀 반복을 위한 자식이 있는 배열(객체 아님)만 취급합니다.
목차
- RecursiveArrayIterator::getChildren — 배열 또는 객체인 경우 현재 항목에 대한 반복자를 반환합니다.
- RecursiveArrayIterator::hasChildren — 현재 항목이 배열인지 객체인지를 반환합니다.