The function of string manipulation in PHP is much more, it is important to have the following:
(1) echo,print,printf,sprintf
The first two functions are output strings. If there is a variable name in the string, it is replaced with its value.
The latter two functions are similar to C's functions with the same name.
(2) Strchr,strlen,strtok,strrchr,strrev,strstr,strtolower,
Strtoupper,substr,ucfirst
These are commonly used string manipulation functions, and some have exactly the same meaning as the same name function in C.
Strrev is to flip a string.
The meaning of Strtolower and strtoupper should not be explained.
Ucfirst is to capitalize the first character of a string.
SUBSTR is a substring of the returned string, using: substr (String, header, length).
The head position is calculated from 0. If it is negative, it is the meaning of the forward number from the tail.
(3) Chr,ord
A function similar to C with the same name.
(4) Explode,implode,join
These are the array-related functions.
Explode (string, delimiter) returns an array that separates the strings from the delimiters.
Implode (array, delimiter) returns a string that divides the elements of an array into delimiters.
Joins have the same meaning as implode.
(5) Chop
Removes whitespace from the trailing end of a string.
(6) Htmlspecialchars
Replace the HTML special characters in the string with their names, for example \ "<\" into \ "<\".
(7) NL2BR
Precede each carriage return in the string with \ "
\".
(8) Addslashes,stripslashes
Add and remove \ "\ \" to the characters in the string that need to be added \ \ \ to be used for database queries.
(9) Parse_str
Parses a string of type \ "Name1=value1&name2=value2&...\" into variables.
For example:
Parse_str (\ "a=1&b=2\");
Generate $ A and $b two variables, respectively.
If there are two pairs of name/value names that are part of the same, then the next value overrides the previous one.
If the tails of both pairs have \ "[]\", for example \ "A[]=1&a[]=2\", the array $ A is generated and two elements are respectively
The above describes how the scanf string uses the string functions in PHP, including the contents of the scanf string, hoping to be helpful to a friend who is interested in PHP tutorials.