Iterator::valid
(PHP 5, PHP 7, PHP 8)
Iterator::valid — 检查当前位置是否有效
参数
此函数没有参数。
+添加备注
用户贡献的备注 2 notes
seva dot lapsha at gmail dot com ¶
15 years ago
If Iterator::valid() returns false, the foreach() loop will be terminated.
Voitcus at gmail dot com ¶
11 years ago
If your class implements also ArrayAccess interface, you could use as valid() body
function valid(){
return $this->offsetExists($this->position);
}