Usage of strstr function in php

Source: Internet
Author: User
Welcome to the Linux community forum and interact with 2 million technical staff to enter the usage of strstr function in php: strstr () function to search 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 (

Welcome to the Linux community forum and interact with 2 million technical staff> Go To The strstr function usage in php: strstr () function to search for the string that appears for the first time 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 (

Welcome to the Linux community forum and interact with 2 million technicians>

Usage of strstr function in php:

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 is required. Specifies the string to be searched.

Search is 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. To perform case-insensitive searches, use the stristr () function.

Example 1:

  

Echo strstr ("Hello world! "," World ");

?>

Output:

World!

Example 2:

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

  

Echo strstr ("Hello world! ", 111 );

?>

Output:

O world!

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.