PHP strripos() Function

Example

Find the last occurrence position of "php" in the string:

<?php
echo strripos("You love php, I love php too!","PHP");
?>

Run Example

Definition and Usage

The strripos() function finds the last occurrence position of the string in another string.

Note:The strripos() function is case-insensitive.

Related Functions:

  • stripos() - Find the first occurrence position of the string in another string (case-insensitive)
  • strpos() - Find the first occurrence position of the string in another string (case-sensitive)
  • strrpos() - Find the last occurrence position of the string in another string (case-sensitive)

Syntax

strripos(string,find,start)
Parameters Description
string Required. Specifies the string to be searched.
find Required. Specifies the character to be searched for.
start Optional. Specifies where to start the search.

Technical Details

Return Value:

Returns the last occurrence position of the string in another string, or returns FALSE if the string is not found.

Note: The string position starts from 0, not from 1.

PHP Version: 5+
Update Log:

Starting from PHP 5.0, the find parameter can be a string containing more than one character.

In PHP 5.0, a new feature was added: start Parameters.