String functions commonly used in PHP operations, php string functions

Source: Internet
Author: User
Tags crc32

String functions commonly used in PHP operations, php string functions
Common PHP string operation functions

String Conversion Functions

Addcslashes function: escape characters in strings using backslash in C Language Style

Addslashes function: uses a backslash to reference a string.

Chop function: clears consecutive spaces in a string.

Get_html_translation_table function: returns the conversion table of the htmlspecialchars () and htmlentities () functions.

Chunk_split function: Splits a string into small parts.

Hebrev function: converts a Hebrew logical character to a visible character.

Hebrevc function: converts Hebrew text to visible text, including line breaks

Html_entity_decode function: convert HTML character encoding to character

Htmlentities function: converts characters to HTML character encoding

Htmlspecialchars_decode function: convert special HTML character encoding to character

Htmlspecialchars function: converts special characters to HTML character encoding.

Nl2br function: converts a line break to "<br>"

Quotemeta function: Add a quote

Rtrim function: clears the white space (or other characters) at the end of the string)

Strip_tags function: Clear HTML and PHP tags

Stripcslashes function: returns the original string processed by the addslashes () function.

Stripslashes function: clears the backslash in the string.

Strtolower function: converts all letters in a string to lowercase letters.

Strtoupper function: converts all letters in a string to uppercase letters.

Trim function: truncates spaces (or other characters) at the beginning and end of a string.

Explode function: Cut string by specified character

Str_pad function: Fill another string with one string to the specified length

Str_split function: converts a string to an array.

Str_shuffle function: Randomly breaks the character order in a string.

Str_ireplace function: replace a substring with another string.

Localeconv function: Get the local numbers and currency Information

Ltrim function: clears consecutive white spaces (or other characters) on the left of the string)

Money_format function: converts a numeric string to a currency representation.

Nl_langinfo function: gets language and region information.

Number_format function: format a numeric string with a thousands Separator

Parse_str function: parses a string into a variable.

Setlocale function: Set region information

Similar_text function: calculates the number of matched strings in two strings.

Str_repeat function: Reuse the specified string

Str_replace function: case-sensitive string replacement

Str_word_count function: returns the number of words in the string.

Strcasecmp function: Compares two strings.

Strlen function: counts the length of a string.

Strnatcmp function: Use natural sequence algorithm to compare strings

Strrev function: reverse string

Strtok function: Cut string

Strtr function: converts certain characters of a string.

Substr_count function: calculates the number of times a string appears in another string.

Substr_replace function: replaces one part of the string with another string.

Substr function: truncates a string.

Ucfirst function: converts the first character in a string to uppercase.

Ucwords function: change the first letter of each word in a string to uppercase.

Wordwrap function: Wrap a string by the number of characters

 

String search functions

Chr function: converts a specified ordinal number to an ASCII character.

Implode function: combines an array into a string.

Join function: converts an array to a string.

Crc32 function: Calculate the crc32 polynomial of a string

Strchr function: returns the substring from its first occurrence position to its end in another string.

Strcspn function: returns the first substring of a string that does not conform to the length of the mask.

Stripos function: searches for the position of the first occurrence of a string in another string (case-insensitive)

Stristr function: returns the substring (case-insensitive) from the first occurrence of a string in another string to the end of the string)

Strripos function: case-insensitive searches for the first occurrence of a character in a string

Strrpos function: searches for the final position of a character in a string.

Strspn function: returns the length of the first child string that matches the mask.

Strstr function: returns the string from start to end of a string.

 

String encoding Functions

Bin2hex function: converts binary to hexadecimal

Convert_cyr_string function: converts a character from one Cyrillic to another.

Convert_uudecode: decodes a string encoded using the uencode algorithm.

Convert_uuencode function: uuencode Algorithm for string Encoding

Count_chars function: returns information about all characters in a string.

Ord function: returns the ASCII code of a character.

Str_rot13 function: rot13 encoding of a string

 

String encryption functions

Crypt function: Uses DES to encrypt strings.

Md5_file function: Calculate the MD5hash of a given file

Md5 function: Performs MD5 encryption on a string.

Sha1_file function: Calculate the sha1hash of a given file

 

Input and Output Functions

Echo function: outputs one or more characters.

Fprintf function: outputs formatted strings to the stream.

Print function: output formatted string

Printf function: outputs a formatted string.

Sprintf: returns a formatted string to a variable.

Sscanf function: parses the input string in a certain format.

Vfprintf function: outputs the formatted string to the stream.

Vprintf function: outputs a formatted string.

Vsprintf function: outputs formatted strings to variables.

 

String comparison functions

Levenshtein function: calculates the Levenshtein distance between two strings.

Metaphone function: calculates the metaphone key of a string.

Soundex function: Calculate the soundex key of a string.

Strcoll function: Compares two strings.

Strcmp function: Compares two strings.

Strnatcasecmp function: Compares strings (Case Insensitive) using natural arithmetic operations)

Strncasecmp function: Compares the first n characters of a string (Case Insensitive)

Strncmp function: Compares the first n characters of two strings.

Strpbrk function: Find a series of characters in a string

 

Strpos function: Find the first position of a character in a string

Strrchr function: finds the position of the last occurrence of a string in another string, and returns the substring from this position in the string to the end of the string.

Substr_compare function: Compares two strings within a certain length from the specified start position (accurate binary, case sensitive)

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.