ArrayIterator 把数组改成迭代器

最后更新于:2022-04-02 02:26:46

[TOC] ## 实例 ``` $arr = new ArrayIterator([3=>'a',1=>'b',2=>'c']); $arr->asort(); while ($arr->valid()){ print_r($arr->current()); $arr->next(); } // output: abc echo "\n"; $arr->ksort(); $arr->rewind(); while ($arr->valid()){ print_r($arr->current()); $arr->next(); } // output: bca ```
';