The CachingIterator class

The CachingIterator class

(PHP 5, PHP 7, PHP 8)

簡介

This object supports cached iteration over another iterator.

類摘要

class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable {
/* 常量 */
const int CALL_TOSTRING = 1;
const int CATCH_GET_CHILD = 16;
const int TOSTRING_USE_KEY = 2;
const int TOSTRING_USE_CURRENT = 4;
const int TOSTRING_USE_INNER = 8;
const int FULL_CACHE = 256;
/* 方法 */
public __construct(Iterator $iterator, int $flags = CachingIterator::CALL_TOSTRING)
public count(): int
public current(): mixed
public getCache(): array
public getFlags(): int
public hasNext(): bool
public key(): scalar
public next(): void
public offsetExists(string $key): bool
public offsetGet(string $key): mixed
public offsetSet(string $key, mixed $value): void
public offsetUnset(string $key): void
public rewind(): void
public setFlags(int $flags): void
public __toString(): string
public valid(): bool
/* 繼承的方法 */
public IteratorIterator::next(): void
}

預定義常量

CachingIterator::CALL_TOSTRING

Convert every element to string.

CachingIterator::CATCH_GET_CHILD

Don't throw exception in accessing children.

CachingIterator::TOSTRING_USE_KEY

Use key for conversion to string.

CachingIterator::TOSTRING_USE_CURRENT

Use current for conversion to string.

CachingIterator::TOSTRING_USE_INNER

Use inner for conversion to string.

CachingIterator::FULL_CACHE

Cache all read data.

更新日誌

版本 說明
8.0.0 CachingIterator implements Stringable now.

目錄

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *