PHP strripos() Function
In this chapter you will learn:
- Definition for PHP strripos() Function
- Syntax for PHP strripos() Function
- Parameter for PHP strripos() Function
- Return for PHP strripos() Function
- Related functions for PHP strripos() Function
- Example - Find the position of the last occurrence of "php" inside the string
Definition
The strripos() function finds the position of the last occurrence of a string inside another string. The strripos() function is case-insensitive.
Syntax
PHP strripos() Function has the following syntax.
strripos(string,find,start)
Parameter
Parameter | Is Required | Description |
---|---|---|
string | Required. | String to search |
find | Required. | String to find |
start | Optional. | Where to begin the search |
Return
PHP strripos() Function returns the position of the last occurrence of a string inside another string, or FALSE if the string is not found.
String positions start at 0, and not 1.
Related functions
- stripos() - Finds the position of the first occurrence of a string inside another string (case-insensitive)
- strpos() - Finds the position of the first occurrence of a string inside another string (case-sensitive)
- strrpos() - Finds the position of the last occurrence of a string inside another string (case-sensitive)
Example
Find the position of the last occurrence of "php" inside the string:
<?php
echo strripos("php from java2s.com","PHP");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP strrpos() Function
- Syntax for PHP strrpos() Function
- Parameter for PHP strrpos() Function
- Return for PHP strrpos() Function
- Related functions for PHP strrpos() Function
- Example - Find the position of the last occurrence of "php" inside the string
- Example - deal with the starting index
Home » PHP Tutorial » PHP String Functions