[doc-en] master: strpos: document that an empty needle matches at every position and returns the offset (#5856)
| From: | Louis-Arnaud via GitHub | Date: | Thu, 10 Sep 2026 14:54:53 +0000 |
| Subject: | [doc-en] master: strpos: document that an empty needle matches at every position and returns the offset (#5856) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23742@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-09-10T16:54:51+02:00
Commit: https://github.com/php/doc-en/commit/dd5db7c6b22c45108b19ca815a0bdf07909bf14a
Raw diff: https://github.com/php/doc-en/commit/dd5db7c6b22c45108b19ca815a0bdf07909bf14a.diff
strpos: document that an empty needle matches at every position and returns the offset (#5856)
Changed paths:
M reference/strings/functions/strpos.xml
Diff:
diff --git a/reference/strings/functions/strpos.xml b/reference/strings/functions/strpos.xml
index d788148cfd9e..5d3d550e7433 100644
--- a/reference/strings/functions/strpos.xml
+++ b/reference/strings/functions/strpos.xml
@@ -35,9 +35,15 @@
<varlistentry>
<term><parameter>needle</parameter></term>
<listitem>
- <para>
+ <simpara>
The string to search for.
- </para>
+ </simpara>
+ <simpara>
+ Passing an empty string as <parameter>needle</parameter> matches at
+ every position. <function>strpos</function> returns
+ <parameter>offset</parameter> when it is specified, or
+ <literal>0</literal> otherwise.
+ </simpara>
&strings.parameter.needle.non-string;
</listitem>
</varlistentry>