PHP string function strpos stripos strrpos strripos

Source: Internet
Author: User

    • strpos– find where the string first appears
    • stripos– find where strings first appear (case insensitive)
    • strrpos– calculates the last occurrence of the specified string in the target string
    • Strripos– calculates the location of the last occurrence of the specified string in the target string (case insensitive)
Mixed Strpos (String $haystack, mixed $needle [, int $offset = 0])

return value

Success: Returns the position where the needle exists at the beginning of the haystack string (independent of offset)
Failed: Returns FALSE if needle is not found.

Note
    1. The string position is starting at 0, not starting from 1
    2. This function may return a Boolean value of false, but it may also return a non-Boolean value that is equivalent to False
      You should use the = = = operator or!== to test the return value of this function
Stripos

Find where strings first appear (case insensitive)

Mixed Stripos (String $haystack, string $needle [, int $offset = 0])

  

Strrpos

Calculates the last occurrence of the specified string in the target string

Mixed Strrpos string $haystack Mixed $needle $offset = 0])
Note
    1. The string position is starting at 0, not starting from 1
    2. This function may return a Boolean value of false, but it may also return a non-Boolean value that is equivalent to False
      You should use the = = = operator or!== to test the return value of this function
Strripos

Calculates the location of the last occurrence of the specified string in the target string (case insensitive)

Mixed Strripos (String $haystack, mixed $needle [, int $offset = 0])

  

PHP string function strpos stripos strrpos strripos

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.