首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

CachingIterator (class)

Introduction

(PHP 5, PHP 7)

This object supports cached iteration over another iterator.

Class synopsis

CachingIterator extends IteratorIterator implements OuterIterator , ArrayAccess , Countable {

/* Constants */

const integer CALL_TOSTRING = 1 ;

const integer CATCH_GET_CHILD = 16 ;

const integer TOSTRING_USE_KEY = 2 ;

const integer TOSTRING_USE_CURRENT = 4 ;

const integer TOSTRING_USE_INNER = 8 ;

const integer FULL_CACHE = 256 ;

/* Methods */

代码语言:javascript
复制
public __construct ( Iterator $iterator [, int $flags = self::CALL_TOSTRING ] )
代码语言:javascript
复制
public int count ( void )
代码语言:javascript
复制
public void current ( void )
代码语言:javascript
复制
public array getCache ( void )
代码语言:javascript
复制
public int getFlags ( void )
代码语言:javascript
复制
public Iterator getInnerIterator ( void )
代码语言:javascript
复制
public void hasNext ( void )
代码语言:javascript
复制
public scalar key ( void )
代码语言:javascript
复制
public void next ( void )
代码语言:javascript
复制
public void offsetExists ( string $index )
代码语言:javascript
复制
public void offsetGet ( string $index )
代码语言:javascript
复制
public void offsetSet ( string $index , string $newval )
代码语言:javascript
复制
public void offsetUnset ( string $index )
代码语言:javascript
复制
public void rewind ( void )
代码语言:javascript
复制
public void setFlags ( int $flags )
代码语言:javascript
复制
public void __toString ( void )
代码语言:javascript
复制
public void valid ( void )

}

Predefined Constants

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.

Table of Contents

  • CachingIterator::__construct — Construct a new CachingIterator object for the iterator.
  • CachingIterator::count — The number of elements in the iterator
  • CachingIterator::current — Return the current element
  • CachingIterator::getCache — Retrieve the contents of the cache
  • CachingIterator::getFlags — Get flags used
  • CachingIterator::getInnerIterator — Returns the inner iterator
  • CachingIterator::hasNext — Check whether the inner iterator has a valid next element
  • CachingIterator::key — Return the key for the current element
  • CachingIterator::offsetExists — The offsetExists purpose
  • CachingIterator::offsetGet — The offsetGet purpose
  • CachingIterator::offsetSet — The offsetSet purpose
  • CachingIterator::offsetUnset — The offsetUnset purpose
  • CachingIterator::rewind — Rewind the iterator
  • CachingIterator::setFlags — The setFlags purpose
  • CachingIterator::__toString — Return the string representation of the current element
  • CachingIterator::valid — Check whether the current element is valid

← ArrayIterator::valid

CachingIterator::__construct →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券