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

Source: Internet
Author: User

Instance

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

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

Definition and usage

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

Note: the Strripos () function is case insensitive.

Related functions:

    • 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)

Grammar

Strripos (String,find,start)
parameters description
string required. Specifies the string to be searched.
find start optional. Specify where to start the search.

technical details

return value: Returns the position of the last occurrence of a string in another string, or FALSE if no string is found. Note: The string position starts at 0, not from 1.
PHP version: 5+
Update log: From PHP 5.0, the find parameter can be a string that is more than one character long.

In PHP 5.0, the start parameter has been added.

Instance

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

<?phpecho strripos ("What's Java and what's php?", "Java"); 
Related Article

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.