草庐IT

IterateAggregate

全部标签

php - 我们可以在 php 的 foreach 循环中使用 IterateAggregate 或 Iterator 吗?

我是php的初学者,是从php.net学习的。该页面(http://php.net/manual/en/class.traversable.php)上的注释说:实现此接口(interface)的内部(内置)类可以在foreach构造中使用,不需要实现IteratorAggregate或Iterator。这个注释说的是什么?这是否意味着我们可以在没有任何类的情况下在foreach循环中使用IteratorAggregate或Iterator或者可能是我错了。谁能说出这个note说的是什么?? 最佳答案 IteratorAggregat