strripos() function
Definition and Usage
strripos() function finds the last occurrence of a string within another string.
Returns the position if successful, false otherwise.
Syntax
strrpos(string,find,start)
参数 |
描述 |
string |
必需。规定被搜索的字符串。 |
find |
必需。规定要查找的字符。 |
start |
可选。规定开始搜索的位置。 |
Tips and Notes
Note: This function is not case sensitive.
Example:
Copy code The code is as follows:
echo strripos("Hello world!","WO");
?>
Output: 6
strrpos() function
Definition and Usage
strrpos() function finds the last occurrence of a string in another string.
Returns the position if successful, false otherwise.
Syntax
strrpos(string,find,start)
参数 |
描述 |
string |
必需。规定被搜索的字符串。 |
find |
必需。规定要查找的字符。 |
start |
可选。规定开始搜索的位置。 |
Tips and Notes
Note: This function is case sensitive. For case-insensitive searches, use strripos().
Example
Copy code The code is as follows:
echo strrpos("Hello world! ","wo");
?>
Output:
6
Use strrpos to verify whether the link is a link of http protocol
Copy the code The code is as follows:
$url="http://www.baidu.com";
if (strrpos($url, 'http://') !== 0)
echo "The link is a link with http protocol ";
?>
http://www.bkjia.com/PHPjc/313679.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313679.htmlTechArticlestrripos() function definition and usage strripos() function finds the last occurrence of a string in another string Location. Returns the position if successful, false otherwise. Grammar...