: This article mainly introduces string processing functions. if you are interested in the PHP Tutorial, you can refer to it. 1. string output function
Echo
Print
High efficiency without echo, not recommended
Die ()
Exit and print string a, or directly die
Printf
Format a string
Sprintf
Returns the formatted string.
2. common string formatting functions
Ltrim ()
Delete white space on the left
Rtrim
Delete the white space on the right
Trim
Remove blank spaces on both sides
Str_pad
Use another string to fill the string with the specified length
Strtolower
Converts a string to lowercase.
Strtopper
Converts a string to uppercase.
Ucfirst
Converts the initial character of a string to uppercase.
Usword
Converts the first letter of each word in a string to uppercase.
Nl2br
Insert the HTML line feed mark before all new lines of the string
Htmlentities
Convert objects to tags
Htmlspecialchars
Convert tags to objects
Stripslashes
Delete backslash
Strip_taps
Delete tags
Md5
Password encryption
3. string comparison functions
Strcmp (a, B)
Sort by byte. if a is smallerB, Returns a negative number. ifAIf the value is greater than B, a positive number is returned. if the two values are equal, 0 is returned.
Strcasecmp ()
Same as above, but not case sensitive
Strnatcmp ()
Sort by natural number
The above introduces the string processing functions, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.