PHP String functions and usage Analysis _php tutorial

Source: Internet
Author: User
Addslashes: String joins a slash.
Bin2Hex: binary turns into 16 decimal.
Chop: Remove continuous whitespace.
CHR: The character that returns the ordinal value.
Chunk_split: Divides the string into small segments.
Convert_cyr_string: Converts an old Slavic string into another string.
Crypt: The string is encrypted with DES encoding.
Echo: the output string.
Explode: Cuts the string.
Flush: Clear out the output buffer.
Get_meta_tags: Extract data from all meta tags of the file.
Htmlspecialchars: Converts special characters into HTML format.
Htmlentities: Turns all characters into HTML strings.
Implode: Turns the array into a string.
Join: Turns the array into a string.
LTrim: Remove continuous whitespace.
MD5: Computes the MD5 of the string.
NL2BR: Converts a newline character to

ORD: Returns the ordinal value of a character.
PARSE_STR: Parses the query string into a variable.
Print: Output string.
printf: Output formatted string.
Quoted_printable_decode: Converts a QP encoded string into a 8-bit string.
Quotemeta: Add reference symbol.
Rawurldecode: Restore from a URL-specific format string to a normal string.
Rawurlencode: Encodes a string into a URL-specific format.
SetLocale: Configure geo-information.
Similar_text: Calculates the similarity of strings.
Soundex: Calculating the phonetic value of a string
sprintf: Formats the string.
STRCHR: Look for the first occurrence of the character.
strcmp: string comparison.
STRCSPN: The length of different strings.
Strip_tags: Remove HTML and PHP markup.
Stripslashes: Remove the backslash character.
Strlen: Gets the string length.
Strrpos: Looks for a character in the string where the last occurrence occurs.
Strpos: Looks for a character in a string that appears first.
STRRCHR: Gets the string that appears at the last occurrence of a character.
Strrev: Reverses the string.
STRSPN: Find out how many strings fall in another string mask.
Strstr: Returns the string from the beginning of the string to the end of a string.
Strtok: Cuts the string.
Strtolower: All strings are converted to lowercase.
Strtoupper: All strings are capitalized.
Str_replace: String substitution.
STRTR: Converts some characters.
SUBSTR: Takes a partial string.
Trim: Truncate the space between the end of the string.
Ucfirst: capitalizes the first character of the string.
Ucwords: capitalizes the first letter of each word in a string.

Addslashes
return value: String
Function type: Data processing
Description: This function makes it necessary for the database to process the string, quotation marks, and a diagonal line for the database queries (query) to work smoothly. The characters that will be changed include single quotation marks (), double quotation marks ("), backslash backslash (), and null character NUL (the null byte).
Reference: Stripslashes () Htmlspecialchars () Quotemeta ()

Bin2Hex
return value: String
Function type: Data processing
Description: This function allows the binary string to be converted to a 16-character string.
Usage examples
Add:
Josh@superfork.com (22-jun-1999) wrote a function that turns 16 binary into binary.
function Hex2bin ($data) {
$len = strlen ($data);
for ($i =0; $i < $len; $i +=2) {
$newdata. = Pack ("C", Hexdec (substr ($string, $i, 2)));
}
return $newdata;
}
?>

Chop
return value: String
Function type: Data processing
Description: This function clears the contiguous whitespace of the string.
Usage examples
$trimmed = Chop ($line);
?>
Reference: Trim ()

Chr
return value: String
Function type: Data processing
Description: This function converts the ordinal of a character to an ASCII character. This function is compared with Ord ().

http://www.bkjia.com/PHPjc/486035.html www.bkjia.com true http://www.bkjia.com/PHPjc/486035.html techarticle addslashes: String joins a slash. Bin2Hex: binary turns into 16 decimal. Chop: Remove continuous whitespace. CHR: The character that returns the ordinal value. Chunk_split: Divides the string into small segments. C ...

  • 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.