Php basic learning-strstr () function

Source: Internet
Author: User
Php basic learning -- strstr () function PHPstrstr () function PHPString function definition and usage strstr () function searches for the first occurrence of a string in another string. This function returns the rest of the string (from the matching point ). If the searched string is not found, false is returned. Basic php learning-strstr () function

PHP strstr () function

PHP String function

Definition and usage

The strstr () function searches for the first occurrence of a string in another string.

This function returns the rest of the string (from the matching point ). If the searched string is not found, false is returned.

Syntax
strstr(string,search)
Parameter description
String Required. Specifies the string to be searched.
Search Required. Specifies the string to be searched. If this parameter is a number, search for characters that match the ASCII value of the number.
Tips and comments

Note: This function is binary secure.

Note: This function is case sensitive. For case-insensitive searches, use? Stristr ().

Example 1
 strstr("Hello world!","world");?>

Output:

world!
Example 2

In this example, we will search for the characters represented by the ASCII value of "o:

 strstr("Hello world!",111);?>

Output:

o world!

PHP String function

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.