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...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn