合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
# Iterator(迭代器)接口 ## **[Iterator(迭代器)接口](https://www.php.net/manual/zh/class.iterator.php#class.iterator)** 使对象支持foreach ``` <pre class="calibre17">``` interface <span class="token4">Iterator</span> extends <span class="token4">Traversable</span> <span class="token3">{</span> <span class="token">/* 方法 */</span> abstract public current <span class="token3">(</span> void <span class="token3">)</span> <span class="token3">:</span> mixed <span class="token">//返回当前产生的值</span> abstract public key <span class="token3">(</span> void <span class="token3">)</span> <span class="token3">:</span> mixed <span class="token">//返回当前产生的键</span> abstract public next <span class="token3">(</span> void <span class="token3">)</span> <span class="token3">:</span> void <span class="token">// 生成器继续执行</span> abstract public rewind <span class="token3">(</span> void <span class="token3">)</span> <span class="token3">:</span> void <span class="token">//重置迭代器</span> abstract public valid <span class="token3">(</span> void <span class="token3">)</span> <span class="token3">:</span> bool <span class="token">//检查迭代器是否被关闭</span> <span class="token3">}</span> ``` ```