Home  >  Article  >  Backend Development  >  PHP function strripos() to find the last occurrence of a string in another string (case insensitive)

PHP function strripos() to find the last occurrence of a string in another string (case insensitive)

黄舟
黄舟Original
2017-11-06 09:13:461509browse

Example

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

Definition and usage

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

Note: The strripos() function is not case-sensitive.

Related functions:

  • stripos() - Find the first occurrence of a string in another string (case-insensitive)

  • strpos() - Find the first occurrence of a string in another string (case sensitive)

  • strrpos() - Find a character The position of the last occurrence of a string in another string (case sensitive)

Syntax

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

Technical details

Return value: Returns a string within another string The position of the last occurrence, or FALSE if the string is not found. Note: The string position starts from 0, not from 1.
PHP version: 5+
Change log: Since PHP 5.0, find The argument can be a string of more than one character.

In PHP 5.0, the start parameter is added.

Example

Find the last occurrence of "java" in the string:


The above is the detailed content of PHP function strripos() to find the last occurrence of a string in another string (case insensitive). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn