The string manipulation functions in PHP are more important, and these are the following:
(1) echo,print,printf,sprintf The first two functions are 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.
(2) Strchr,strlen,strtok,strrchr,strrev,strstr,strtolower, Strtoupper,substr,ucfirst These are commonly used 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.
The meaning of Strtolower and strtoupper should not be explained.
Ucfirst the first character of a string into uppercase.
SUBSTR is a substring of the return string, using the following: 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 Similar to C's function of the same name.
(4) Explode,implode,join These are the functions that are related to the array.
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 Removes whitespace from the tail of the string.
(6) Htmlspecialchars Replace the HTML special characters in the string with their names, for example, "<\" becomes \ "<\."
(7) nl2br Plus \ "<br>\" in front of each carriage return in the string.
(8) addslashes,stripslashes
(9) Parse_str Parse the \ "name1=value1&name2=value2&...\" type of string into variables.
For 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 the names of both pairs have \ []\], such as \ a[]=1&a[]=2\, the array $a is generated, and the two elements are 1,2
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.