String learning mainly involves mastering built-in functions.
There are too many functions, and I haven’t remembered many yet. I will simply record the functions first and add them later.
1. Definition method: single quote, double quote, or {}
{} is convenient for displaying index arrays, and double quotes parse variables
2. Manually convert string data
symbol to implement
The addslashes() and addcslashes() functions can be used to customize the transfer
3. Serialization and deserialization serialize(), unserialize()
4. String sorting
trim(), ltrim(), rtrim()
Remove spaces, newline characters (n, r), horizontal and vertical tab characters (t, v) and string terminators (
5. Format string
nl2br()
wordwrap()
strtolower()
strtoupper()
ucfirst()
ucwords()
6. Split
explode() and join() with the same name
Example: explode("@",$email) ;
7. String interception
substr(‘target string’, starting point, end point)
8. strlen() / mb_strlen()
9. str_word_count()
Combined with array_count_values() to count the number of word occurrences
10. Search www.2cto.com
strstr($string,"keyword") ,stristr() ,strrch()
strpos()
str_repeat()
substr_count()
11. Processing
str_replace()
substr_replace()
strrev()
htmlspecialchars(), htmlentitles() Convert special characters such as <,>,&, " into html entities
strip_tags() clear html tags
strncmp(),strcmp()
Strok() parses string
strpbrk()
strspn(),strcspn()
str_replace()
http://www.bkjia.com/PHPjc/477718.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477718.htmlTechArticleString learning is mainly about mastering built-in functions. There are too many functions, and I haven’t memorized many yet. I will simply record the functions first and add them later. 1. Definition method: single quote, double quote...