php's strstr () function searches for the first occurrence of a string in another string,And return the rest of the string.
The strstr () function is defined as follows:
strstr (string, search, before_search)
string is required. Specifies the string to be searched.
essential. Specifies the search string.
If this parameter is numeric,Search for characters that match the ascii value for this number.
Optional. The default value is a Boolean value of "false".
If set to "true", it returns the part of the string before the first occurrence of the search parameter.
The sample code is as follows:
<?php echo "<br />"; echo "<br />"; echo strstr ("123456789", "5"); ?>
The results are as follows:
The third optional parameter to the strstr () function is only available after PHP 5.3.Such as:
echo strstr ("123456789", "5", true); //Output:1234
- Examples of common PHP string processing functions [transform, escape, intercept, compare, find, reverse, cut]
- How to find the number of occurrences of a string in php
- Php method to find where string appears through strpos
- Php method using substr () and strpos () jointly to find a specific character in a string
- Summary of the differences between the four functions strstr, strrchr, substr, stristr in PHP
- Strpos, strstr and stripos, stristr function analysis in PHP
- PHP common string search functions strstr () and strpos ()
- python 3x - typeerror: 'method' object is not subscriptable
- python - you may need to restart the kernel to use updated packages error
- xcode - pod install [!] no `podfile 'found in the project directory
- android studio - unresolved reference comes out in kotlin
- android studio - emulator: dsound: could not initialize about the error message directsoundcapture
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- django - oserror: [winerror 123] the file name, directory name, or volume label syntax is incorrect : '<frozen importlib_boot
- mysql startup failed [error] innodb: the innodb_system data file 'ibdata1' must be writable
- python - importerror: cannot import name md5 error cannot be resolved