PHP strripos()Functions

PHP String 参考手册PHP String Reference Manual

Examples

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

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

Run Example »

Definition and Usage

The strripos() function finds the position of the last occurrence of a string within another string (case-insensitive).

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

Related functions:

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

Syntax

strripos(string,find,start)

Parameter Description
string Required. Specifies the string to be searched.
find Required. Specifies the character to search for.
start Optional. Specifies the position where to start the search.

Technical Details

Return Value: Returns the position of the last occurrence of a string within another string, or FALSE if the string is not found.Note:String positions start at 0, not at 1.
PHP Version: 5+
Changelog: As of PHP 5.0,findThe parameter can be a string of more than one character.

In PHP 5.0, thestartparameter was added.


PHP String 参考手册PHP String Reference Manual Other Extensions