另一种高级方法称为 ArrayIterator 。它是更广泛的 class 的一部分,它公开了许多可访问的 variables 和 functions 。您更有可能将此视为 PHP 类和大量 object-oriented 项目的一部分。 $fnames = ["Muhammed", "Ali", "Fatimah", "Hasan", "Hussein"]; $arrObject = new ArrayObject($fnames); $arrayIterator = $arrObject->getIterator(); while( $arrayIterator->valid() ){ echo $arrayIterator->current() . "<br />"; $arrayIterator->next(); } 原文由 Freeman 发布,翻译遵循 CC BY-SA 4.0 许可协议
另一种高级方法称为
ArrayIterator
。它是更广泛的class
的一部分,它公开了许多可访问的variables
和functions
。您更有可能将此视为PHP
类和大量object-oriented
项目的一部分。