Home >Backend Development >PHP Problem >How to use php strripos function?

How to use php strripos function?

青灯夜游
青灯夜游Original
2019-05-30 11:59:582737browse

php The strripos() function is used to find the last occurrence of a string in another string (case-insensitive). The syntax is strripos(string,find,start). If the string is not found, FALSE is returned.

How to use php strripos function?

php How to use strripos() function?

The strripos() function finds the last occurrence of a character in a string, and is not case-sensitive.

Syntax:

strripos(string,find,start)

Parameters:

● String: Required. Specifies the string to be searched for.

● Find: Required. Specifies the characters to search for.

● Start: Optional. Specifies where to start the search.

Return value: Returns the position of the last occurrence of a string in another string, or FALSE if the string is not found.

Note: strripos() function is not case sensitive. String positions start at 0, not 1.

Let’s take a look at how to use the php strripos() function through an example.

php strripos() function example 1:

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

Output:

21

php strripos() function example 2:

<?php
echo strripos("PHP is a good development language! I love PHP","php");
?>

Output:

43

The above is the detailed content of How to use php strripos function?. 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