reference/strings/functions/strstr.xml
c276fff86c44bc92a9f9105aa66342a731ac78d8
...
...
@@ -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.strstr">
3
+
<refentry xml:id="function.strstr" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strstr</refname>
6
6
<refpurpose>Find the first occurrence of a string</refpurpose>
...
...
@@ -9,9 +9,9 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>strstr</methodname>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>strstr</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>bool</type><parameter>before_needle</parameter><initializer>&false;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
...
...
@@ -27,9 +27,9 @@
27
27
</note>
28
28
<note>
29
29
<para>
30
-
If you only want to determine if a particular <parameter>needle</parameter>
31
-
occurs within <parameter>haystack</parameter>, use the faster and less memory
32
-
intensive function <function>strpos</function> instead.
30
+
If it is only required to determine if a particular <parameter>needle</parameter>
31
+
occurs within <parameter>haystack</parameter>, the faster and less memory
32
+
intensive <function>str_contains</function> function should be used instead.
33
33
</para>
34
34
</note>
35
35
</refsect1>
...
...
@@ -49,6 +49,9 @@
49
49
<varlistentry>
50
50
<term><parameter>needle</parameter></term>
51
51
<listitem>
52
+
<para>
53
+
The string to search for.
54
+
</para>
52
55
&strings.parameter.needle.non-string;
53
56
</listitem>
54
57
</varlistentry>
...
...
@@ -86,16 +89,17 @@
86
89
</row>
87
90
</thead>
88
91
<tbody>
92
+
&strings.changelog.needle-empty;
89
93
<row>
90
-
<entry>5.3.0</entry>
94
+
<entry>8.0.0</entry>
91
95
<entry>
92
-
Added the optional parameter <parameter>before_needle</parameter>.
96
+
Passing an &integer; as <parameter>needle</parameter> is no longer supported.
93
97
</entry>
94
98
</row>
95
99
<row>
96
-
<entry>4.3.0</entry>
100
+
<entry>7.3.0</entry>
97
101
<entry>
98
-
<function>strstr</function> was made binary safe.
102
+
Passing an &integer; as <parameter>needle</parameter> has been deprecated.
99
103
</entry>
100
104
</row>
101
105
</tbody>
...
...
@@ -116,7 +120,7 @@ $email = 'name@example.com';
116
120
$domain = strstr($email, '@');
117
121
echo $domain; // prints @example.com
118
122

119
-
$user = strstr($email, '@', true); // As of PHP 5.3.0
123
+
$user = strstr($email, '@', true);
120
124
echo $user; // prints name
121
125
?>
122
126
]]>
...
...
@@ -139,7 +143,6 @@ echo $user; // prints name
139
143
</refsect1>
140
144

141
145
</refentry>
142
-

143
146
<!-- Keep this comment at the end of the file
144
147
Local variables:
145
148
mode: sgml
146
149