How to use the PHPstristr () function for character search. We use the PHPstristr () function to find the position where the string first appears in another string. Define and use the PHPstristr () function to search for strings in another string.
PHP stristr () function -- finds the position of the string that appears for the first time in another string.
Define and use the PHP stristr () function to find the position where the string first appears 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)
Parameters and descriptions
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 ().
Example 1 of the PHP stristr () function
- < ?php
- echo stristr("Hello world!","WORLD");
-
- ?>
Output:
World!
PHP stristr () function Example 2
- < ?php
- echo stristr("Hello world!",111);
- ?>
-
Output:
O world!
Using PHP stristr () function -- finds the position where the string first appears in another string. Define and use the PHP stristr () function to find the first string in another string...