ArrayIterator クラス

(PHP 5, PHP 7)

はじめに

このイテレータは、配列やオブジェクトを反復処理する際に 値やキーをリセットしたり修正したりすることができます。

同じ配列を何度も反復処理したい場合は、 ArrayObject のインスタンスとそれを参照する ArrayIterator のインスタンスを作成し、 foreach を使用するか getIterator() メソッドを手動でコールします。

クラス概要

ArrayIterator implements ArrayAccess , SeekableIterator , Countable , Serializable {
/* 定数 */
const int STD_PROP_LIST = 1 ;
const int ARRAY_AS_PROPS = 2 ;
/* メソッド */
public append ( mixed $value ) : void
public asort ( ) : void
public __construct ( mixed $array = array() , int $flags = 0 )
public count ( ) : int
public current ( ) : mixed
public getArrayCopy ( ) : array
public getFlags ( ) : int
public key ( ) : mixed
public ksort ( ) : void
public natcasesort ( ) : void
public natsort ( ) : void
public next ( ) : void
public offsetExists ( mixed $index ) : bool
public offsetGet ( mixed $index ) : mixed
public offsetSet ( mixed $index , mixed $newval ) : void
public offsetUnset ( mixed $index ) : void
public rewind ( ) : void
public seek ( int $position ) : void
public serialize ( ) : string
public setFlags ( string $flags ) : void
public uasort ( callable $cmp_function ) : void
public uksort ( callable $cmp_function ) : void
public unserialize ( string $serialized ) : void
public valid ( ) : bool
}

定義済み定数

ArrayIterator のフラグ

ArrayIterator::STD_PROP_LIST

オブジェクトのプロパティが、 リストとして(var_dump, foreach などから)アクセスされたときの通常の機能を持つ

ArrayIterator::ARRAY_AS_PROPS

エントリがプロパティとしてアクセスできる(読み書きともに)

目次