reference/strings/functions/strripos.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.strripos">
3
+
<refentry xml:id="function.strripos" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strripos</refname>
6
6
<refpurpose>Find the position of the last occurrence of a case-insensitive substring in a string</refpurpose>
...
...
@@ -9,9 +9,9 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>int</type><methodname>strripos</methodname>
12
+
<type class="union"><type>int</type><type>false</type></type><methodname>strripos</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>
...
...
@@ -39,6 +39,9 @@
39
39
<varlistentry>
40
40
<term><parameter>needle</parameter></term>
41
41
<listitem>
42
+
<para>
43
+
The string to search for.
44
+
</para>
42
45
&strings.parameter.needle.non-string;
43
46
</listitem>
44
47
</varlistentry>
...
...
@@ -46,9 +49,22 @@
46
49
<term><parameter>offset</parameter></term>
47
50
<listitem>
48
51
<para>
49
-
If specified, search will start this number of characters counted from the
50
-
beginning of the string. If the value is negative, search will instead start
51
-
from that many characters from the end of the string, searching backwards.
52
+
If zero or positive, the search is performed left to right skipping the
53
+
first <parameter>offset</parameter> bytes of the
54
+
<parameter>haystack</parameter>.
55
+
</para>
56
+
<para>
57
+
If negative, the search is performed right to left skipping the
58
+
last <parameter>offset</parameter> bytes of the
59
+
<parameter>haystack</parameter> and searching for the first occurrence
60
+
of <parameter>needle</parameter>.
61
+
<note>
62
+
<para>
63
+
This is effectively looking for the last occurrence of
64
+
<parameter>needle</parameter> before the last
65
+
<parameter>offset</parameter> bytes.
66
+
</para>
67
+
</note>
52
68
</para>
53
69
</listitem>
54
70
</varlistentry>
...
...
@@ -62,7 +78,11 @@
62
78
Returns the position where the needle exists relative to the beginnning of
63
79
the <parameter>haystack</parameter> string (independent of search direction
64
80
or offset).
65
-
Also note that string positions start at 0, and not 1.
81
+
<note>
82
+
<simpara>
83
+
String positions start at 0, and not 1.
84
+
</simpara>
85
+
</note>
66
86
</para>
67
87
<para>
68
88
Returns &false; if the needle was not found.
...
...
@@ -70,6 +90,36 @@
70
90
&return.falseproblem;
71
91
</refsect1>
72
92

93
+
<refsect1 role="changelog">
94
+
&reftitle.changelog;
95
+
<informaltable>
96
+
<tgroup cols="2">
97
+
<thead>
98
+
<row>
99
+
<entry>&Version;</entry>
100
+
<entry>&Description;</entry>
101
+
</row>
102
+
</thead>
103
+
<tbody>
104
+
&strings.changelog.ascii-case-folding;
105
+
&strings.changelog.needle-empty;
106
+
<row>
107
+
<entry>8.0.0</entry>
108
+
<entry>
109
+
Passing an &integer; as <parameter>needle</parameter> is no longer supported.
110
+
</entry>
111
+
</row>
112
+
<row>
113
+
<entry>7.3.0</entry>
114
+
<entry>
115
+
Passing an &integer; as <parameter>needle</parameter> has been deprecated.
116
+
</entry>
117
+
</row>
118
+
</tbody>
119
+
</tgroup>
120
+
</informaltable>
121
+
</refsect1>
122
+

73
123
<refsect1 role="examples">
74
124
&reftitle.examples;
75
125
<para>
...
...
@@ -118,7 +168,6 @@ if ($pos === false) {
118
168
</refsect1>
119
169

120
170
</refentry>
121
-

122
171
<!-- Keep this comment at the end of the file
123
172
Local variables:
124
173
mode: sgml
125
174