reference/strings/functions/strpos.xml
71b1e926631d5f5bec9b2e2685553453349ae799
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strpos">
3
+
<refentry xml:id="function.strpos" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strpos</refname>
6
6
<refpurpose>Find the position of the first occurrence of a substring in a string</refpurpose>
...
...
@@ -9,9 +9,9 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>mixed</type><methodname>strpos</methodname>
12
+
<type class="union"><type>int</type><type>false</type></type><methodname>strpos</methodname>
13
13
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
14
-
<methodparam><type>mixed</type><parameter>needle</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
15
15
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
...
...
@@ -36,9 +36,9 @@
36
36
<term><parameter>needle</parameter></term>
37
37
<listitem>
38
38
<para>
39
-
If <parameter>needle</parameter> is not a string, it is converted
40
-
to an integer and applied as the ordinal value of a character.
39
+
The string to search for.
41
40
</para>
41
+
&strings.parameter.needle.non-string;
42
42
</listitem>
43
43
</varlistentry>
44
44
<varlistentry>
...
...
@@ -46,8 +46,8 @@
46
46
<listitem>
47
47
<para>
48
48
If specified, search will start this number of characters counted from
49
-
the beginning of the string. Unlike <function>strrpos</function> and
50
-
<function>strripos</function>, the offset cannot be negative.
49
+
the beginning of the string. If the offset is negative, the search will start
50
+
this number of characters counted from the end of the string.
51
51
</para>
52
52
</listitem>
53
53
</varlistentry>
...
...
@@ -68,6 +68,41 @@
68
68
&return.falseproblem;
69
69
</refsect1>
70
70

71
+
<refsect1 role="changelog">
72
+
&reftitle.changelog;
73
+
<informaltable>
74
+
<tgroup cols="2">
75
+
<thead>
76
+
<row>
77
+
<entry>&Version;</entry>
78
+
<entry>&Description;</entry>
79
+
</row>
80
+
</thead>
81
+
<tbody>
82
+
&strings.changelog.needle-empty;
83
+
<row>
84
+
<entry>8.0.0</entry>
85
+
<entry>
86
+
Passing an &integer; as <parameter>needle</parameter> is no longer supported.
87
+
</entry>
88
+
</row>
89
+
<row>
90
+
<entry>7.3.0</entry>
91
+
<entry>
92
+
Passing an &integer; as <parameter>needle</parameter> has been deprecated.
93
+
</entry>
94
+
</row>
95
+
<row>
96
+
<entry>7.1.0</entry>
97
+
<entry>
98
+
Support for negative <parameter>offset</parameter>s has been added.
99
+
</entry>
100
+
</row>
101
+
</tbody>
102
+
</tgroup>
103
+
</informaltable>
104
+
</refsect1>
105
+

71
106
<refsect1 role="examples">
72
107
&reftitle.examples;
73
108
<para>
...
...
@@ -141,6 +176,9 @@ $pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
141
176
<para>
142
177
<simplelist>
143
178
<member><function>stripos</function></member>
179
+
<member><function>str_contains</function></member>
180
+
<member><function>str_ends_with</function></member>
181
+
<member><function>str_starts_with</function></member>
144
182
<member><function>strrpos</function></member>
145
183
<member><function>strripos</function></member>
146
184
<member><function>strstr</function></member>
...
...
@@ -152,7 +190,6 @@ $pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
152
190
</refsect1>
153
191

154
192
</refentry>
155
-

156
193
<!-- Keep this comment at the end of the file
157
194
Local variables:
158
195
mode: sgml
159
196