PHP strrpos () function
Examples
Find "php" position in the string of the last occurrence:
<?php
echo strrpos("I love php, I love php too!","php");
?>
echo strrpos("I love php, I love php too!","php");
?>
Running instance »
Definition and Usage
strrpos () function to find the position of a string in another string of the last occurrence (case-sensitive).
Note: strrpos () function is case-sensitive.
Related functions:
- strpos () - Find the string in another string of the first occurrence (case-sensitive)
- stripos () - Find the position of a string in another string of the first occurrence (case insensitive)
- strripos () - Find the position of a string in another string of the last occurrence (case insensitive)
grammar
strrpos( string,find,start )
参数 | 描述 |
---|---|
string | 必需。规定被搜索的字符串。 |
find | 必需。规定要查找的字符。 |
start | 可选。规定开始搜索的位置。 |
technical details
return value: | Returns the string in another string of the last occurrence of the string if not found returns FALSE. Note: The position of the string starting from 0, not 1. |
---|---|
PHP version: | 4+ |
Update log: | Since PHP 5.0 onwards, find more than one parameter can be a character string. In PHP 5.0, add the start parameters. |
PHP String Reference