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
- < ?php
- echo stristr("Hello world!","WORLD");
- ?>
Output:
World!
PHP function stristr () Example 2
- < ?php
- echo stristr("Hello world!",111);
- ?>
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...