String string processing function in PHP full version

Source: Internet
Author: User
Tags explode md5 hash rtrim

Article Source: PHP Development Learning Portal

Address: http://www.phpthinking.com/archives/602

Development habits commonly used string processing function grooming:
STRTR () converts a specific character in a string.
SUBSTR () returns part of a string.
STRSTR () The first occurrence of a search string in another string (case sensitive)
Str_replace () replaces some characters in a string. (Sensitive to case)
strcmp () compares two strings. (Sensitive to case)
Strlen () returns the length of the string.
Substr_count () calculates the number of occurrences of a substring in a string.
Substr_replace () Replace part of a string with another string

Implode () combines the array elements into a single string.
Explode () splits a string into an array with the specified delimiter

Json_encode () parses an array into a JSON-form string
Json_decode () parses a JSON string into an array element
String string handler function detailed list:

Addcslashes () adds a backslash before the specified character.
Addslashes () adds a backslash before the specified predefined character.
Bin2Hex () Converts a string of ASCII characters to a hexadecimal value.
Alias of Chop () RTrim ().
Chr () returns characters from the specified ASCII value.
Chunk_split () splits the string into a series of smaller parts.
Convert_cyr_string () converts a character from one Cyrillic character to another.
Convert_uudecode () decodes a uuencode encoded string.
Convert_uuencode () encodes a string using the uuencode algorithm.
Count_chars () returns information about the characters used in the string.
CRC32 () computes the 32-bit CRC of a string.
Crypt () One-way string encryption (hashing).
The Echo () output string.
Explode () breaks the string into arrays.
fprintf () writes the formatted string to the specified output stream.
Get_html_translation_table () returns the translation table.
Hebrev () Converts a right-to-left stream of Hebrew text to a left-to-right stream.
HEBREVC () ibid., and CONVERT (\ n) to <br/>.
Html_entity_decode () converts an HTML entity to a character.
Htmlentities () converts a character to an HTML entity.
Htmlspecialchars_decode () converts some pre-defined HTML entities to characters.
Htmlspecialchars () converts some of the predefined characters to HTML entities.
Implode () combines the array elements into a single string.
Alias for Join () implode ().
Levenshtein () returns the Levenshtein distance between two strings.
Localeconv () returns an array containing the local numeric and currency information formats.
LTrim () removes spaces or other predefined characters from the left side of the string.
MD5 () computes the MD5 hash of the string.
Md5_file () computes the MD5 hash of the file.
Metaphone () computes the Metaphone key for the string.
Money_format () formats the string as a currency string.
Nl_langinfo () returns the specified local information.
NL2BR () inserts an HTML newline character before each new line in the string.
Number_format () formats a number by using a thousands grouping.
Ord () returns the ASCII value of the first character of a string.
Parse_str () parses the query string into a variable.
Print () outputs one or more strings.
The printf () output formatted string.
Quoted_printable_decode () decodes the quoted-printable string.
Quotemeta () adds a backslash before certain predefined characters in the string.
RTrim () removes whitespace characters or other predefined characters from the end of the string.
SetLocale () Sets the region information (geographic information).
SHA1 () computes the SHA-1 hash of the string.
Sha1_file () computes the SHA-1 hash of the file.
Similar_text () calculates the number of matching characters for two strings.
Soundex () computes the Soundex key for the string.
sprintf () writes the formatted string to a variable.
SSCANF () parses an input from a string according to the specified format.
Str_ireplace () replaces some characters in a string. (not sensitive to case)
Str_pad () fills the string with a new length.
Str_repeat () repeats the string to the specified number of times.
Str_replace () replaces some characters in a string. (Sensitive to case)
STR_ROT13 () performs ROT13 encoding on the string.
Str_shuffle () randomly scrambles all characters in a string.
Str_split () splits the string into an array.
Str_word_count () calculates the number of words in a string.
STRCASECMP () compares two strings. (not sensitive to case)
STRCHR () Searches for the first occurrence of a string in another string. Alias for Strstr ()
strcmp () compares two strings. (Sensitive to case)
Strcoll () compares two strings (based on local settings).
STRCSPN () returns the number of characters to look up in a string before any specified character is found.
Strip_tags () Strips HTML, XML, and PHP tags.
Stripcslashes () removes backslashes added by the addcslashes () function.
Stripslashes () removes backslashes added by the addslashes () function.
Stripos () returns the position of the first occurrence of a string in another string (case insensitive)
Stristr () finds the position of the first occurrence of a string in another string (case insensitive)
Strlen () returns the length of the string.
STRNATCASECMP () uses a "natural" algorithm to compare two strings (not case sensitive)
STRNATCMP () uses a "natural" algorithm to compare two strings (case sensitive)
STRNCASECMP () A string comparison of the first n characters (not case sensitive).
STRNCMP () A string comparison of the first n characters (case sensitive).
STRPBRK () searches the string for any one of the specified characters.
Strpos () returns the position of the first occurrence of a string in another string (case sensitive)
STRRCHR () finds the position of the last occurrence of a string in another string.
Strrev () reverses the string.
Strripos () finds the last occurrence of a string in another string (not case sensitive)
Strrpos () finds where the string last appears in another string (case sensitive)
STRSPN () returns the number of specific characters contained in the string.
STRSTR () The first occurrence of a search string in another string (case sensitive)
Strtok () splits the string into smaller strings.
Strtolower () Converts the string to lowercase.
Strtoupper () Converts the string to uppercase.
STRTR () converts a specific character in a string.
SUBSTR () returns part of a string.
Substr_compare () compares two strings from a specified start length.
Substr_count () calculates the number of occurrences of a substring in a string.
Substr_replace () replaces part of a string with another string.
Trim () removes white-space characters and other predefined characters from both ends of the string.
Ucfirst () converts the first character in a string to uppercase.
Ucwords () converts the first character of each word in a string to uppercase.
vfprintf () writes the formatted string to the specified output stream.
vprintf () outputs a formatted string.
vsprintf () writes the formatted string to the variable.
WordWrap () lines the string by the specified length.

For detailed usage, please refer to: http://cn2.php.net/ref.strings.php

String string processing function in PHP full version

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.