CachingIterator 类

(PHP 5, PHP 7, PHP 8)

简介

该对象支持在另一迭代器上缓存迭代。

类摘要

classCachingIteratorextendsIteratorIteratorimplementsArrayAccess, Countable, Stringable {
publicconstintCALL_TOSTRING;
publicconstintCATCH_GET_CHILD;
publicconstintFULL_CACHE;
public__construct(Iterator$iterator, int$flags = CachingIterator::CALL_TOSTRING)
publiccount(): int
publiccurrent(): mixed
publicgetCache(): array
publicgetFlags(): int
publichasNext(): bool
publickey(): scalar
publicnext(): void
publicoffsetGet(string$key): mixed
publicoffsetSet(string$key, mixed$value): void
publicoffsetUnset(string$key): void
publicrewind(): void
publicsetFlags(int$flags): void
publicvalid(): bool
}

预定义常量

CachingIterator::CALL_TOSTRING

每个元素转换为字符串。

CachingIterator::CATCH_GET_CHILD

访问子元素时不要抛出异常。

CachingIterator::TOSTRING_USE_KEY

转换为字符串时使用 key

CachingIterator::TOSTRING_USE_CURRENT

转换为字符串时使用 current

CachingIterator::TOSTRING_USE_INNER

转换为字符串时使用 inner

CachingIterator::FULL_CACHE

缓存所有读取的数据。

更新日志

版本说明
8.0.0CachingIterator 现在实现了 Stringable

目录

To Top