How to use the PHP function stristr () _ PHP Tutorial

Source: Internet
Author: User
Describes how to use the PHP function stristr. In actual encoding, we can find strings. If we need to find the location where another string appears for the first time, how should we write it? Today, we will find strings in actual encoding. If we need to find the location where another string appears for the first time, how should we write it? What we will introduce to you today Definition and usage

The PHP function stristr () is used to locate the first occurrence of a string in another string. If successful, the rest of the string is returned (from the matching point ). If this string is not found, false is returned.

Syntax

Stristr (string, search)

Parameter description

String is required. Specifies the string to be searched.
Find is required. Specifies the characters to be searched. If this parameter is a number, search for characters matching the ASCII value of the number.

Tip and comment: This function is binary secure.

Note: This function is case insensitive. Use strstr () for case-sensitive searches ().

PHP function stristr () Example 1

 
 
  1. < ?php
  2. echo stristr("Hello world!","WORLD");
  3. ?>

Output:

World!

PHP function stristr () Example 2

 
 
  1. < ?php
  2. echo stristr("Hello world!",111);
  3. ?>

Output:

O world!


Bytes. If we need to find the location where another string appears for the first time, how should we write it? Today we are...

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.