mb_strrichr
Case insensitively looking for the last occurrence of a specified character in another string
Function name: mb_strrichr()
Applicable version: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Usage: The mb_strrichr() function is used to search for the specified character in a string and return the last occurrence of the character. This function is an extension to the mb_strrchr() function and is case-insensitive.
Syntax: mb_strrichr(string $haystack, string $needle [, bool $part [, string $encoding = mb_internal_encoding()]]): string|false
parameter:
Return value:
Example:
$str = "Hello, World!"; $lastPos = mb_strrichr($str, "o"); echo $lastPos; // 输出"orld!" $lastPos = mb_strrichr($str, "O"); echo $lastPos; // 输出"orld!" $lastPos = mb_strrichr($str, "o", true); echo $lastPos; // 输出"o, World!" $lastPos = mb_strrichr($str, "O", true); echo $lastPos; // 输出"o, World!"
Notes: