mb_strrchr
(PHP 5 >= 5.2.0, PHP 7, PHP 8)
mb_strrchr — 查找指定字符在另一个字符串中最后一次的出现
说明
mb_strrchr(
string
string
bool
string
): string
string
$haystack
,string
$needle
,bool
$part
= false,string
$encoding
= mb_internal_encoding()): string
mb_strrchr() 查找了 needle
在 haystack
中最后一次出现的位置,并返回 haystack
的部分。
如果没有找到 needle
,它将返回 false
。
参数
-
haystack
-
在该字符串中查找
needle
最后出现的位置 -
needle
-
在
haystack
中查找这个字符串 -
part
-
决定这个函数返回
haystack
的哪一部分。 如果设置为true
,它将返回的字符是从haystack
的开始到needle
最后出现的位置。 如果设置为false
,它将返回的字符是从needle
最后出现的位置到haystack
的末尾。 -
encoding
-
使用的字符编码名称。如果省略了,则将使用内部编码。
返回值
返回 haystack
的一部分。
或者在没有找到 needle
时返回 false
。
参见
- strrchr() - 查找指定字符在字符串中的最后一次出现
- mb_strstr() - 查找字符串在另一个字符串里的首次出现
- mb_strrichr() - 大小写不敏感地查找指定字符在另一个字符串中最后一次的出现

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