PHP string Function Strripos () example

Source: Internet
Author: User
php string function strripos definition and syntax?

The PHP Strripos () function is where the last occurrence of a string is found in another string. This function is case-insensitive and its related functions are:

    • Stripos ()-finds the position of the first occurrence of a string in another string (case insensitive)

    • Strpos ()-finds the position of the first occurrence of a string in another string (case-sensitive)

    • Strrpos ()-Finds the last occurrence of a string in another string (case-sensitive)

Syntax for PHP strripos () function

Strripos (String,find,start)

The function has three parameters, where the first two parameters are necessary, the third parameter is optional

Parameters Description
String Necessary. Specifies the string to be searched.
Find Necessary. Specifies the character to find.
Start Optional. Specify where to start the search.

The return value of the PHP Strripos () function

The Strripos () function returns the position of the last occurrence of a string in another string, or FALSE if no string is found. the string position starts at 0, not starting from 1.

PHP Strripos () Function Example

Use the PHP strripos () function to find the location of the last occurrence of "PHP" in the string, with the following code:

<?phpecho Strripos ("You love php, I love php too!", "PHP"); >

The code runs the browser output result:

"Related articles recommended"

The definition and usage of PHP string function Stripos ()

PHP Strpos () function instance detailed

Detailed string function Strrpos ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.