PHP Common string manipulation functions

Source: Internet
Author: User
Tags crc32 md5 encryption

string Conversion class functions

addcslashes function: Use backslash to escape characters in a string in C language style

addslashes function: Using a backslash to reference a string

Chop function: Clears contiguous spaces in a string

get_html_translation_table function: Returns the conversion table for the Htmlspecialchars () function and the htmlentities () function

Chunk_split function: Splitting a string into small chunks

Hebrev function: Convert Hebrew logical characters to visible characters

Hebrevc function: Convert hebrew text to visible text, including newline characters

Html_entity_decode function: Convert HTML character encoding to character

htmlentities function: Convert character to HTML character encoding

Htmlspecialchars_decode function: Convert special HTML character encoding to character

Htmlspecialchars function: Convert special characters to HTML character encoding

NL2BR function: Converts a newline character to a "<br>"

Quotemeta function: Adding a reference character

RTrim function: Clears whitespace (or other characters) at the end of a string

Strip_tags function: Clear html and PHP tags

Stripcslashes function: Returns the string after processing with the addslashes () function as-is

stripslashes function: Clears backslashes in a string

Strtolower function: Converts all letters in a string to lowercase

Strtoupper function: Converts all letters in a string to uppercase

Trim function: Intercepts string-ending spaces (or other characters) string manipulation class functions

Explode function: Cut a string by the specified character

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

Str_split function: Convert a string to an array

Str_shuffle function: Randomly disrupts character order in a string

Str_ireplace function: Replacing a substring with another string

Localeconv function: Get local numbers and currency information

LTrim function: Clears contiguous whitespace (or other characters) from the left side of the string

Money_format function: Convert a numeric string to a currency representation

Nl_langinfo function: Get language and region information

Number_format function: Formatting numeric strings with thousands separators

Parse_str function: Parsing a string into a variable

setlocale function: Setting region information

Similar_text function: Calculates the number of matched strings in two strings

Str_repeat function: Repeat with specified string

Str_replace function: Case-sensitive string substitution

Str_word_count function: Returns the number of words in a string

strcasecmp function: Compare two strings

strlen function: The length of the statistic string

strnatcmp function: Using natural sequential algorithms to compare strings

Strrev function: Invert string

Strtok function: Cut the string

STRTR function: Convert some characters of a string

Substr_count function: Calculates the number of occurrences of a string in another string

Substr_replace function: Replacing part of a string with another string

substr function: Intercept string

Ucfirst function: Change the first character in a string to uppercase

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

WordWrap function: Wraps a string by the number of characters

String Lookup class function

Chr function: Converts the specified ordinal number to the corresponding ASCII code character

Implode functions: merging arrays into strings

Join function: Converting an array to a string

CRC32 function: Computes the crc32 polynomial of a string

STRCHR function: Returns the position of the first occurrence of a string in another string to the end of a substring

STRCSPN function: Returns the length of a substring in a string that does not match the mask

Stripos function: Find where a string first appears in another string (case insensitive)

Stristr function: Returns a substring of the first occurrence of a string in another string to the end of the latter (case insensitive)

Strripos function: Case-insensitive find where characters first appear in a string

Strrpos function: Find the position of the last occurrence of a character in a string

STRSPN function: Returns the length of the substring of the initial mask in a string

Strstr function: Returns the string starting at the beginning of a string in a string

string-coded class functions

Bin2Hex function: Converts binary characters to hexadecimal

convert_cyr_string function: Converts a character from one Cyrillic character to another

Convert_uudecode function: Decoding a string encoded with the UUENCODE algorithm

Convert_uuencode function: Uuencode algorithm encoding for strings

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 a string

String Encryption class function

Crypt function: Encrypt strings with des encoding

Md5_file function: Calculates the md5hash of a given file

MD5 function: MD5 encryption of a string

Sha1_file function: Calculates the sha1hash of a given file

Input and output functions

echo function: Output one or more characters

fprintf function: Output formatted string to stream

Print function: Output formatted string

printf function: Output a formatted string

sprintf function: Returns a formatted string to a variable

sscanf function: Parsing input strings in a certain format

vfprintf function: Output formatted string to stream

vprintf function: Output a formatted string

vsprintf function: Output formatted string to variable

string comparison class functions

Levenshtein function: Calculates the levenshtein distance of two strings

Metaphone function: Computes the Metaphone key of a string

Soundex function: Computes the SOUNDEX key of a string

strcoll function: Compare two strings

strcmp function: Compare two strings

strnatcasecmp function: Comparing Strings with natural algorithms (case insensitive)

strncasecmp function: Compare the first n characters of a string (case insensitive)

strncmp function: Compare the first n characters of a two string

strpbrk function: Finding a series of characters in a string

Strpos function: Finding where a character in a string first appears

STRRCHR function: Finds the position of the last occurrence of a string in another string and returns a substring from this position in the string until the end of the string

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

PHP Common string manipulation functions

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.