Home  >  Article  >  Backend Development  >  Detailed explanation of php string function strripos() example

Detailed explanation of php string function strripos() example

怪我咯
怪我咯Original
2017-06-08 15:53:063164browse

The definition and syntax of php string function strripos?

php strripos() function is to find the last occurrence of a string in another string. This function is not case-sensitive. Its related functions are:

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

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

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

php strripos() function syntax

strripos(string,find,start)

This function has three parameters, the first two parameters are required, and the third parameter is optional

Required. Specifies the string to be searched for. Required. Specifies the characters to search for. Optional. Specifies the location from which to start the search.
Parameter Description
##string
find
start

php strripos() function return value

strripos() function

returns a string in another string The position of the last occurrence in , or FALSE if the string is not found. The string position starts from 0, not from 1.

php strripos() function example

Use the php strripos() function to find the last occurrence of "php" in the string. The code is as follows:

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

The code runs the browser output result:

Detailed explanation of php string function strripos() example

[Related article recommendations]

##php The definition and usage of string function stripos()

php strpos() function example detailed explanation

Detailed explanation of string function strrpos()

The above is the detailed content of Detailed explanation of php string function strripos() example. 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