ArrayIterator 类
(PHP 5, PHP 7)
简介
这个迭代器允许在遍历数组和对象时删除和更新值与键。
当你想多次遍历相同数组时你需要实例化 ArrayObject,然后让这个实例创建一个 ArrayIteratror 实例。 当你想遍历相同数组时多次你需要实例 ArrayObject 并且让这个实例创建一个 ArrayIteratror 实例,然后使用foreach 或者 手动调用 getIterator() 方法。
类摘要
/* 常量 */
/* 方法 */
}预定义常量
ArrayIterator 标记
ArrayIterator::STD_PROP_LIST
-
Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).
ArrayIterator::ARRAY_AS_PROPS
-
可以通过属性访问条目(读写都支持)。
Table of Contents
- ArrayIterator::append — Append an element
- ArrayIterator::asort — Sort array by values
- ArrayIterator::__construct — Construct an ArrayIterator
- ArrayIterator::count — Count elements
- ArrayIterator::current — Return current array entry
- ArrayIterator::getArrayCopy — Get array copy
- ArrayIterator::getFlags — Get behavior flags
- ArrayIterator::key — Return current array key
- ArrayIterator::ksort — Sort array by keys
- ArrayIterator::natcasesort — Sort an array naturally, case insensitive
- ArrayIterator::natsort — Sort an array naturally
- ArrayIterator::next — Move to next entry
- ArrayIterator::offsetExists — Check if offset exists
- ArrayIterator::offsetGet — Get value for an offset
- ArrayIterator::offsetSet — Set value for an offset
- ArrayIterator::offsetUnset — Unset value for an offset
- ArrayIterator::rewind — Rewind array back to the start
- ArrayIterator::seek — Seek to position
- ArrayIterator::serialize — Serialize
- ArrayIterator::setFlags — Set behaviour flags
- ArrayIterator::uasort — Sort with a user-defined comparison function and maintain index association
- ArrayIterator::uksort — Sort by keys using a user-defined comparison function
- ArrayIterator::unserialize — Unserialize
- ArrayIterator::valid — Check whether array contains more entries