Note: For example, $ STR = "this is a book! "; $ STR [0] or $ STR {0} indicates" T ", and so on.
// Remove spaces and other symbols
1. String trim (string STR [, string charlist]): Remove spaces or other characters on both sides
2. String ltrim (string STR [, string charlist]): removes spaces or other characters on the left.
3. String rtrim (string STR [, string charlist]): The de-space on the left or other characters. The Chop () function is the alias of rtrim () and has the same functions.
// Converts string uppercase and lowercase letters.
4. String strtoupper (string Str): converts a string to uppercase.
5. String strtolower (string Str): converts a string to lowercase.
6. String ucfirst (string Str): If the first character of a string is a letter, convert it to uppercase.
7. String ucword (string Str): converts the first letter of each word in the string to uppercase.
// Add and delete backslash
8. String addslashes (string Str): Add a backslash.
9. String stripslashes (string Str): deletes the backslash.
// Html format
10. String nl2br (string Str): converts line breaks such as "\ n" into the "<br>" tag in HTML to implement line breaks in the browser.
11. String htmlspecialchars (string STR [, int quote_style [, string charset]): used to display some special characters (such as "&
"," "," <, And so on) without directly parsing HTML.
12. String htmlentities (string STR [, int quote_style [, string charset]): basically consistent with htmlspecialchars ()
But this function can escape more HTML characters. The third parameter sometimes needs to be added because it prevents garbled characters and can be added as "gb2312 ".
13. String html_entity_decode (string STR [, int quote_style [, string charset]): opposite to htmlentities, it can
The display string is converted to reverse conversion. The converted string can be parsed in HTML format.
14. String strip_tags (string STR [, string tags]): removes all HTML and PHP tags. Tags indicates the characters that are not removed.
// Connect and separate character Lu
15. array explode (string separator, string STR [, int limit]): Split string
16. array implode (string glue, array pieces): connects multiple strings. Glue indicates the connector connecting multiple strings; pieces indicates the Array
17. array join (string glue, array pieces): achieves the same effect as implode.
18. array substr (string STR, int start [, int length]): extract part of the string
19. String strtok (string STR, string separator): string segmentation and extraction. It obtains only one string. To obtain all strings, use the loop language.
Sentence output.
20. array split (string separator, string STR [, int limit]): Splits a string.
// String comparison
21. Int strcmp (string str1, string str2): Compares strings. It is case sensitive. Compares strings in alphabetical order. That is
The string after the dictionary is greater than the previous string. If $ str1 is greater than $ str2, a positive number is returned. Otherwise, a negative number is returned.
22. Int strcasecmp (string str1, string str2): Compares strings (case-insensitive). Other functions are consistent with strcmp () functions.
.
23. Int strnatcmp (string str1, string str2): String comparison by natural sorting. That is, sort by the habits in people's daily life, 7 small
But in strcmp, 7 is greater than 56. The difference is here. The natural sorting here is case sensitive.
24. Int strnatcasecmp (string str1, string str2): Compare by natural order (case-insensitive). Other and functions and strnatcmp () are
Same
// Search and replace strings
----- Search
25. String strstr (string STR, string key): Find a string. Returns the string from the key to the end. If multiple matches exist, only
The first one. This function is case sensitive. In addition, strchr () has the same function as this function.
26. String stristr (string STR, string key): it is basically the same as the strstr () function, but it is case insensitive.
27. String strrchr (string STR, string key): it is basically the same as strstr (). This function is also case sensitive. This function is enabled from the end.
Search for matched strings. If no matching string is found, false is returned. If no matching string is found, the string from key to tail is returned. If more than one match exists, the system returns the result starting from the end.
The first matched string to be searched.
28. Int strpos (string STR, string key [, int offset]): locate the first occurrence of a specified string or character in the original string.
Offset cannot be negative. This function is case sensitive. The first character is 0. Therefore, when comparing whether the sizes are equal, you must use the "=" constant equation.
29. Int strrpos (string STR, string key [, int offset]): it is basically the same as the strpos () function, but it is searched from the tail.
Is case sensitive
30. Int strripos (string STR, string key [, int offset]): The function is basically the same as strrpos (). The only difference is that it is unpartitioned.
Case Sensitive
31. Int stripos (string STR, string key [, int offset]): this function is basically the same as strpos (), but it is case insensitive.
----- Replace
32. Mixed str_replace (mixed search, mixed replace, Mixed Subject [, Int & COUNT]): replace. Find and replace the content
It can be expressed as an array. This is case sensitive.
33. String substr_replace (string STR, string replacement, int start [, int length]):
34. Mixed str_ireplace (mixed search, mixed replace, Mixed Subject [, Int & COUNT]): this function is similar to str_replace ().
Consistent, but this function is case insensitive.
// Other common string functions
35. Int strlen (string Str): calculates the string length. Spaces are also calculated.
36. String CHR (int ascii): Convert the ASCII code to a character.
37. Int ord (string Str): converts a character to an ASCII value. Similar to the CHR () function.
38. Int similar_text (string first, string second [, float & percent]): Compares the similarity of strings. The returned value is a matched character.
Number. & Percent is not written as a transfer address.
39. String strrev (string Str): reverse string
40. Int strspn (string str1, string str2 [, int start [, int length]): calculates the matching length. Where, start and length are
Should be at the beginning and end of $ str1, please do not mess up
41. Int strcspn (string str1, string str2 [, int start [, int length]): Calculate the non-matching length. Note that it is case sensitive.
Of
42. Void parse_str (string STR [, array arr]): breaks down the string and saves it to the variable. It is usually used for URL resolution.
43. mixed str_word_count (string STR [, int format]): calculates the number of words contained in a string.
44. string wordwrap (string STR [, int width [, string break [, bool cut]): Wrap a string by the number of characters
45. string str_repeat (string STR, int multiplier): Repeated string combination
46. string MD5 (string STR [, bool raw_output]): Calculate the MD5 value of a string.
47. string md5_file (string Str): Performs MD5 encryption on an object. The usage is similar to that of the MD5 () function.