107
PHP strripos() Function
The strripos() is predefine string function of PHP. It is used to find the position of the last occurrence of a string inside another string.
Syntax:
Parameter | Description | Required/Optional |
---|---|---|
String | Specify the string to search. | Required |
Find | Specify he string to find. | Required |
Start | Specify where to begin the search. | Optional |
The function strripos() returns the position of the last occurrence of a string. Or FALSE if the string is not found. String position starts at 0 and not 1.
Note: The strripos() function is case-insensitive.
Example 1
Output:
By using 'strripos()' function: 16
Example 2
Output:
Congratulations! We found the last (aB) in (ababcd) at position (2)
See Also:
- stripos(): It is used to return the position of the first occurrence of a string inside another string.
- strpos(): It is used to return the position of the first occurrence of a string inside another string.
- strrchr() : It is used to find the last occurrence of a string inside another string.
- strrev() : It is used to reverse a string.
Reference:
http://php.net/manual/en/function.strripos.php
Next TopicPHP String