Php5 and mysql5web development technology-2 string operations. String learning is mainly to master built-in functions. There are too many functions, so far I have not remembered much. I will simply record the functions and then add them later. 1. Definition: single quotes and double quotes are used to learn built-in functions.
There are too many functions, so far I have not remembered much. I will simply record the functions and then add them later.
1. definition method: single quotation marks, double quotation marks, or {}
{} Easy to display index arrays, variable parsing with double quotation marks
2. manually convert string data
\ Symbol to implement
You can use the addslashes () and addcslashes () functions to customize the transfer.
3. serialize () and unserialize ()
4. string sorting
Trim (), ltrim (), rtrim ()
Remove spaces, line breaks (\ n, \ r), horizontal and vertical tabs (\ t, \ v), and string terminator (\ 0) from the string ).
5. format the string
Nl2br ()
Wordwrap ()
Strtolower ()
Strtoupper ()
Ucfirst ()
Ucwords ()
6. segmentation
Explode () and join () with the same name ()
Example: explode ("@", $ email );
7. string truncation
Substr ('Destination string', start point, end point)
8. strlen ()/mb_strlen ()
9. str_word_count ()
Use array_count_values () to calculate the number of times a word appears.
10. search for www.2cto.com
Strstr ($ string, "Keyword"), stristr (), strrch ()
Strpos ()
Str_repeat ()
Substr_count ()
11. handling
Str_replace ()
Substr_replace ()
Strrev ()
Htmlspecialchars () and htmlentitles () convert special characters such as <,>, &, and "to html entities
Strip_tags () clear html tag
Strncmp (), strcmp ()
Strok () parses strings
Strpbrk ()
Strspns (), strcspns ()
Str_replace ()
Bytes. There are too many functions, so far I have not remembered much. I will simply record the functions and then add them later. 1. Definition: single quotes, double quotes...