array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'class.arrayiterator.php', 1 => 'ArrayIterator', ), 'up' => array ( 0 => 'spl.iterators.php', 1 => '迭代器', ), 'prev' => array ( 0 => 'appenditerator.valid.php', 1 => 'AppendIterator::valid', ), 'next' => array ( 0 => 'arrayiterator.append.php', 1 => 'ArrayIterator::append', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/spl/arrayiterator.xml', ), 'extra_header_links' => array ( 'rel' => 'alternate', 'href' => '/manual/en/feeds/class.arrayiterator.atom', 'type' => 'application/atom+xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
允许在迭代数组和对象时删除元素以及更新值或键。
当你想多次遍历相同数组时你需要实例化 ArrayObject,然后让这个实例创建一个 ArrayIterator 实例。 当你想遍历相同数组时多次你需要实例 ArrayObject 并且让这个实例创建一个 ArrayIterator 实例,然后使用 foreach 或者手动调用 getIterator() 方法。
ArrayIterator::STD_PROP_LIST
Properties of the object have their normal functionality when accessed as list (var_dump, foreach, etc.).
ArrayIterator::ARRAY_AS_PROPS
可以通过属性访问条目(读写都支持)。