There are many character string operations in PHP3.0, including the following:
(1) echo, print, printf, sprintf
Used to output the string. If there is a variable name in the string, it will be replaced with its value. The last two functions are similar to functions with the same name in C.
(2) strchr, strlen, strtok, strrchr, strrev, strstr, strtolower, strtoupper, substr, ucfirst
The string operation function used. Some functions with the same name in C have exactly the same meaning. strrev is used to flip a string. strtolower and strtoupper convert strings to lower case and upper case. ucfirst converts the first character of a string to uppercase. substr is a substring of the returned string. Its usage is substr (string, header, length ). the header position is counted from 0. if it is a negative number, it indicates the forward number from the tail.
(3) Chr, Ord
Function of the same name.
(4) explode, implode, join
Array-related functions. explode (string, delimiter) returns an array generated when the string is split. implode (array, delimiter) returns a string that inserts a delimiter into each element of the array. join and implode have the same meaning.
(5) Chop
Process the white space at the end of the string.
(6) htmlspecialchars
Replace special HTML characters with their names, for example, "<" to "<".
(7) nl2br
Add"
".
(8) AddSlashes, StripSlashes
Add "" and remove "to the string as needed. For some databases, you must add and remove" "to the character to be queried before you can query.
(9) parse_str
Analyze the string of the "name1 = value1 & name2 = value2 &..." type into some variables.
For example: parse_str ("a = 1 & B = 2"); generate two variables $ a and $ B, with values 1, 2, respectively. if two pairs of Names/values have the same name, the latter value overwrites the previous one. if the two pairs have "[]" at the end, for example, "a [] = 1 & a [] = 2", an array $, the two elements are respectively 1, 2.