[doc-en] master: Document that next() and prev() cannot bring back a pointer moved out of the array (#6155)
| From: | Louis-Arnaud via GitHub | Date: | Wed, 25 Nov 2026 21:12:42 +0000 |
| Subject: | [doc-en] master: Document that next() and prev() cannot bring back a pointer moved out of the array (#6155) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-24021@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-25T22:12:37+01:00
Commit: https://github.com/php/doc-en/commit/b9ea47a0b2200554e499ded0256a9e1db2a3ec22
Raw diff: https://github.com/php/doc-en/commit/b9ea47a0b2200554e499ded0256a9e1db2a3ec22.diff
Document that next() and prev() cannot bring back a pointer moved out of the array (#6155)
Changed paths:
M reference/array/functions/next.xml
M reference/array/functions/prev.xml
Diff:
diff --git a/reference/array/functions/next.xml b/reference/array/functions/next.xml
index 8a4e6910e914..114424c5632f 100644
--- a/reference/array/functions/next.xml
+++ b/reference/array/functions/next.xml
@@ -42,6 +42,11 @@
Returns the array value in the next place that's pointed to by the
internal array pointer, or &false; if there are no more elements.
</para>
+ <simpara>
+ Once the internal array pointer has moved past the last element, it stays
+ there until the array is modified: <function>prev</function> cannot move it
+ back. Use <function>reset</function> or <function>end</function> to
reposition it.
+ </simpara>
&return.falseproblem;
</refsect1>
diff --git a/reference/array/functions/prev.xml b/reference/array/functions/prev.xml
index 794bd8a69061..f94057f1ff24 100644
--- a/reference/array/functions/prev.xml
+++ b/reference/array/functions/prev.xml
@@ -41,6 +41,11 @@
the internal array pointer, or &false; if there are no more
elements.
</para>
+ <simpara>
+ Once the internal array pointer has moved before the first element, it stays
+ there until the array is modified: <function>next</function> cannot move it
+ back. Use <function>reset</function> or <function>end</function> to
reposition it.
+ </simpara>
&return.falseproblem;
</refsect1>