mb_strstr
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb_strstr — 查找字符串在另一个字符串里的首次出现
说明
mb_strstr(
string
string
bool
string
): string
string
$haystack
,string
$needle
,bool
$before_needle
= false,string
$encoding
= mb_internal_encoding()): string
mb_strstr() 查找了 needle
在 haystack
中首次的出现并返回 haystack
的一部分。
如果 needle
没有找到,它将返回 false
。
参数
-
haystack
-
要获取
needle
首次出现的字符串。 -
needle
-
在
haystack
中查找这个字符串。 -
before_needle
-
决定这个函数返回
haystack
的哪一部分。 如果设置为true
,它返回haystack
中从开始到needle
出现位置的所有字符(不包括 needle)。 如果设置为false
,它返回haystack
中needle
出现位置到最后的所有字符(包括了 needle)。 -
encoding
-
要使用的字符编码名称。 如果省略该参数,将使用内部字符编码。
返回值
返回 haystack
的一部分,或者 needle
没找到则返回 false
。

User Contributed Notes
There are no user contributed notes for this page.