Common php functions, php Functions

Source: Internet
Author: User
Tags md5 hash

Common php functions, php Functions

PHP string functions are the core component of PHP. These functions can be used without installation.

Function Description
Addcslashes () Returns the string with the backslash added before the specified character.
Addslashes () Returns a string with a backslash added before a predefined character.
Bin2hex () Converts an ASCII string to a hexadecimal value.
Chop () Delete the white space or other characters on the right of the string.
Chr () Returns characters from the specified ASCII value.
Chunk_split () Splits a string into a series of smaller parts.
Convert_cyr_string () Converts a string from one Cyrillic character set to another.
Convert_uudecode () Decodes uencode encoded strings.
Convert_uuencode () The uuencode algorithm is used to encode the string.
Count_chars () Returns information about the characters used in the string.
Crc32 () Calculates the 32-bit CRC of a string.
Crypt () One-way string encryption (hashing ).
Echo () Output one or more strings.
Explode () Splits the string into an array.
Fprintf () Writes formatted strings to the specified output stream.
Get_html_translation_table () Returns the translation tables used by htmlspecialchars () and htmlentities.
Hebrev () Converts a Hebrew text to a visible text.
Hebrevc () Convert the Hebrew text to visible text and convert the new line (\ n) to <br>.
Hex2bin () Converts a hexadecimal string to an ASCII character.
Html_entity_decode () Converts an HTML object to a character.
Htmlentities () Converts a character to an HTML object.
Htmlspecialchars_decode () Convert some predefined HTML entities into characters.
Htmlspecialchars () Convert some predefined characters into HTML objects.
Implode () Returns a string composed of array elements.
Join () The alias of implode.
Lcfirst () Converts the first character of a string to lowercase.
Levenshtein () Returns the Levenshtein distance between two strings.
Localeconv () Returns the information about the local number and currency format.
Ltrim () Removes white spaces or other characters from the left side of the string.
Md5 () Calculate the MD5 hash of the string.
Md5_file () Calculate the MD5 hash of the file.
Metaphone () Calculate the metaphone key of the string.
Money_format () Returns the string formatted as a currency string.
Nl_langinfo () Returns specific local information.
Nl2br () Insert an HTML line break before each new line in the string.
Number_format () Format a number in a kilobytes.
Ord () Returns the ASCII value of the first character in the string.
Parse_str () Parses the query string into a variable.
Print () Output one or more strings.
Printf () Output formatted string.
Quoted_printable_decode () Converts the quoted-printable string to an 8-Bit String.
Quoted_printable_encode () Converts an 8-bit string to a quoted-printable string.
Quotemeta () Reference metacharacters.
Rtrim () Removes spaces or other characters from the right of the string.
Setlocale () Set region information (region information ).
Sha1 () Calculate the SHA-1 hash of the string.
Shaw.file () The SHA-1 hash of the computing file.
Similar_text () Calculate the similarity between two strings.
Soundex () Calculate the soundex key of the string.
Sprintf () Write formatted strings to variables.
Sscanf () Parses the input from the string according to the specified format.
Str_getcsv () Parses the CSV string into an array.
Str_ireplace () Replace some characters in the string (Case Insensitive ).
Str_pad () Fill the string with a new length.
Str_repeat () Specifies the number of times the string is repeated.
Str_replace () Replace some characters in the string (case sensitive ).
Str_rot13 () Execute the ROT13 encoding on the string.
Str_shuffle () All characters in the string are randomly disrupted.
Str_split () Splits the string into an array.
Str_word_count () Calculates the number of words in a string.
Strcasecmp () Compares two strings (Case Insensitive ).
Strchr () Search for the first occurrence of a string in another string. (Strstr () alias .)
Strcmp () Compares two strings (case sensitive ).
Strcoll () Compare two strings (based on local settings ).
Strcspn () Returns the number of characters found in the string before any part of a specified character is found.
Strip_tags () Removes HTML and PHP tags from strings.
Stripcslashes () Delete the backslash added by the addcslashes () function.
Stripslashes () Delete the backslash added by the addslashes () function.
Stripos () Returns the position of the first occurrence of a string in another string (Case Insensitive ).
Stristr () Search for the location where the string appears for the first time in another string (Case Insensitive ).
Strlen () Returns the length of a string.
Strnatcasecmp () Use a "natural sorting" algorithm to compare two strings (Case Insensitive ).
Strnatcmp () Use a "natural sorting" algorithm to compare two strings (case sensitive ).
Strncasecmp () String comparison of the First n characters (not case sensitive ).
Strncmp () String comparison of the First n characters (case sensitive ).
Strpbrk () Search for any character of a group of characters in a string.
Strpos () Returns the position (case sensitive) of the first occurrence of a string in another string ).
Strrchr () Find the last occurrence of a string in another string.
Strrev () Returns the reverse string.
Strripos () Locate the last occurrence of a string in another string (Case Insensitive ).
Strrpos () Locate the last occurrence of a string in another string (case sensitive ).
Strspns () Returns the number of characters contained in a string.
Strstr () Search for the first appearance of a string in another string (case sensitive ).
Strtok () Splits a string into smaller strings.
Strtolower () Converts a string to lowercase letters.
Strtoupper () Converts a string to uppercase letters.
Strtr () Character in the conversion string.
Substr () Returns a part of the string.
Substr_compare () Compares two strings at the specified starting position (Binary secure and case-sensitive.
Substr_count () Calculates the number of times a substring appears in a string.
Substr_replace () Replace one part of the string with another.
Trim () Removes spaces and other characters from both sides of the string.
Ucfirst () Converts the first character in the string to uppercase.
Ucwords () Converts the first character of each word in a string to uppercase.
Vfprintf () Writes formatted strings to the specified output stream.
Vprintf () Output formatted string.
Vsprintf () Write the formatted string to the variable.
Wordwrap () The interrupt string is a specified number of strings.

Function used for Form Verification:

Function test_input ($ data) {$ data = trim ($ data); // removes spaces and other characters on both sides of the string. $ Data = stripslashes ($ data); // Delete the backslash added by the addslashes () function. $ Data = htmlspecialchars ($ data); // convert some predefined characters into HTML objects. Return $ data ;}

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.