[DOC-CVS] [doc-en] master: Extend Iterator::rewind note to mention NoRewindIterator (#5110)
[email protected] (Louis-Arnaud via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-01-30T10:33:05Z
Commit: https://github.com/php/doc-en/commit/7fbb16f538011636999459326a55d5f153ef2c61
Raw diff: https://github.com/php/doc-en/commit/7fbb16f538011636999459326a55d5f153ef2c61.diff
Extend Iterator::rewind note to mention NoRewindIterator (#5110)
Changed paths:
M language/predefined/iterator/rewind.xml
Diff:
diff --git a/language/predefined/iterator/rewind.xml b/language/predefined/iterator/rewind.xml
index b907668ca644..990db8761d41 100644
--- a/language/predefined/iterator/rewind.xml
+++ b/language/predefined/iterator/rewind.xml
@@ -21,6 +21,15 @@
&foreach; loop. It will <emphasis>not</emphasis> be
executed <emphasis>after</emphasis> &foreach; loops.
</para>
+ <simpara>
+ As &foreach; always calls <methodname>rewind</methodname> before starting
+ iteration, manually advancing the iterator position (for example via
+ <methodname>SplFileObject::seek</methodname>) will be reset.
+ </simpara>
+ <simpara>
+ To iterate without rewinding the iterator, wrap it in a
+ <classname>NoRewindIterator</classname>.
+ </simpara>
</note>
</refsect1>