function | The string manipulation function in string PHP3.0 is much more important for the following:
(1) echo,print,printf,sprintf
is used for output strings. If a variable name is substituted in the string, it is replaced with its value. The latter two functions are similar to C's with the same name function.
uses string manipulation functions, some of which have exactly the same meaning as the functions of the same name in C. Strrev is to flip a string. Strtolower and Strtoupper convert strings to lowercase and uppercase. Ucfirst is to capitalize the first character of the string. SUBSTR is a substring of the return string, which is: substr (string, header, length). The head position is from 0. If it's a negative number, it's from the tail forward.
(3) Chr,ord
a function with the same name.
(4) Explode,implode,join
the array-related functions. Explode (string, delimiter) returns an array of characters that are produced by separating the string from the separator. Implode (array, delimiter) returns a string that inserts a delimiter between the elements of an array. Join has the same meaning as implode.
(5) Chop
handles the blanks in the tail of the string.
(6) Htmlspecialchars
the HTML special characters into their names, such as "<" to "<".
(7) nl2br
Add "<BR>" in front of each carriage return in HTML.
(8) addslashes,stripslashes
add "\" to the string and remove "\", for some databases, you must query the character plus and remove "\" before you can query.
(9) Parse_str
the string of "Name1=value1&name2=value2& ..." into some variables.
Example: Parse_str ("a=1&b=2"); Generates $a and $b two variables with a value of 1,2. If there are two names that are part of the same name/value, then the last value overrides the previous one. If both pairs have "[]" at the end, such as "a[]=1&a[]=2", the array $a is generated, and the two elements are 1,2 respectively.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.