PHP Common string disposition function

Source: Internet
Author: User
PHP Common string processing functions

PHP String Operations Common functions

/*

* Determine string length

* int strlen (string str)

* Comparison of two strings

* 1, strcmp function on two string binary security comparison, and case-sensitive

* int strcmp (string str1,string str2)

* 2. Compare two strings in a case-insensitive manner

* int strcasecmp (string str1,string str2)

* 3, two strings of the same part

* int strspn (string str1,string str2)

* 4, ask for two different parts of a string

* int strcspn (string str1,string str2)

* Handle string case

* 1. Convert all strings to lowercase

* String Strtolower (String str)

* 2. Convert all strings to uppercase

* String Strtoupper (String str)

* 3. Capitalize the first character of the string

* String Ucfirst (String str)

* 4. Turn each word in the string into uppercase

* String Ucword (String str)

* Strings and HTML are converted to each other

* 1. Convert newline characters to HTML termination tags

* String bl2br (String str)

* 2, the special character conversion wieldhtml equivalent form

* String Htmlentities (String Str[,int quote_style[,int charset])

* 3. Use special HTML characters for other purposes

* String Htmlspecialchars (String Str[,int quote_style[,string charset])

* 4. Convert text to HTML equivalent form

* Array get_html_translaction_table (int table[,int Quote_style])

* 5. Create a custom conversion list

* String Strtr (string Str,array replacements)

* 6. Convert HTML to plain text

* String Strip_tags (String str[,string allowable_tags])

* Alternative functions for regular expression functions

* 1. The Strtok function parses a string based on a list of predefined strings

* String Strtok (string str,string tonens)

* 2. Parse string according to predefined delimiter

* Array Explode (string separator,string str[,int limit])

* 3. Convert an array to a string

* String implode (string delimiter, array array)

* 4. Parsing complex strings

* int Strpos (string str,string substr[,int offset])

* 5, find the last occurrence of the string

* int Strrpos (string Str,char substr[,offset])

* 6. Replace all instances of a string with another string

* Mixed Str_replace (string occurrence,mixed replacement,mixed str[,int count])

* 7. Get part of a string strstr returns the remainder of the first occurrence of a predefined string in a string

* String Strstr (string str,string occurrence)

* 8. Returns part of a string according to a predefined offset

* String substr (string str,int start[,ing length])

* 9, determine the frequency of the occurrence of the string

* int Substr_count (string str,string substring)

* 10. Replace part of a string with another string

* String Substr_replace (string str,string replacement,int start[,int length])

* Fill and reject strings

* 1. Start clipping character from string

* String LTrim (String str[,string charliset])

* 2. Crop characters from the end of a string

* String RTrim (String str[,string charliset])

* 3. Crop characters from both ends of the string

* String Trim (string str[,string charliset])

* 4, padding string

* String Str_pad (string Str,int length[,string pad_string[,int Pad_type])

* Character and Word count

* 1, character count in string

* Mixed Count_chars (string Str[,mode])

* 2, the total number of words in the string count

* Mixed Str_word_count (string str[,int format])

*/
  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.