1. Strpos function
Strpos (String,find,start)
Example:
<?php Echo Strpos ("Hello world!", "Wo");
Output 6
2. substr function
SUBSTR (String,start,length)
Where start is the parameter
Positive number-starts at the specified position in the string
Negative number-starts at the specified position from the end of the string
0-Starts at the first character in a string
<?php echo substr ("Hello world!", 6,5); ?>
Output World
3. strstr function
The Strstr () function searches for the first occurrence of a string in another string.
The function returns the remainder of the string (from the matching point). returns false if the searched string is not found.
Strstr ('[email protected]', ' @ ', TRUE); Parameter set True to return the header before the lookup value @, ABC
Strstr (' zhang@jbxue.com ', ' @ '); The default returns the trailing end after the lookup value @, @jbxue. Co
4.STRRCHR ()
STRRCHR (String,char)
The STRRCHR () function finds the last occurrence of a string in another string and returns all characters from that position to the end of the string.
If it fails, it returns false.
strrchr("Hello world!","world")
;? >
Output:
world!
5.
Similar functions :STRCHR (),
Find the 12th string where it appears, and then intercept to the end!
Truncation of five kinds of strings