PHP uses the strstr () function to obtain all characters after a specified string, strstr string. PHP uses the strstr () function to obtain all characters after a specified string. This document describes how PHP uses the strstr () function to obtain all characters after a specified string. Use the strstr () function in PHP to obtain all characters after a specified string.
This example describes how PHP uses the strstr () function to obtain all characters after a specified string. We will share this with you for your reference. The details are as follows:
The strstr () function of PHP searches for the first occurrence position of a string in another string and returns the rest of the string.
The strstr () function is defined as follows:
Strstr (string, search, before_search)
Parameter description:
String is required. Specifies the string to be searched.
Search
Required. Specifies the string to be searched.
If this parameter is a number, search for characters matching the ASCII value of this number.
Before_search
Optional. The default value is a Boolean value of "false.
If it is set to "true", it returns the string section before the first appearance of the search parameter.
The sample code is as follows:
<? Php echo strstr ("Welcome to the customer's house", "script"); echo"
"; Echo strstr (" Welcome To www.jb51.net "," jb51 "); echo"
"; Echo strstr (" 123456789 "," 5 ");?>
The running result is as follows:
Helper House jb51.net56789
Supplement:
The third optional parameter of the strstr () function can be used only after PHP5.3, for example:
Echo strstr ("123456789", "5", true); // output: 1234