PHP character functions 12th page. AddSlashes: Adds a slash to the string. Bin2hex: binary to hexadecimal. Chop: removes consecutive gaps. Chr: returns the character of the ordinal value. Chunk_split: splits a string into segments. Convert AddSlashes: Adds a slash to the string.
Bin2hex: binary to hexadecimal.
Chop: removes consecutive gaps.
Chr: returns the character of the ordinal value.
Chunk_split: splits a string into segments.
Convert_cyr_string: convert the ancient Slavic string to another string.
Crypt: encrypt the string with DES encoding.
Echo: output string.
Explode: cut string.
Flush: clears the output buffer.
Get_meta_tags: extracts all metadata marked by meta from the file.
Htmlspecialchars: Convert Special characters into HTML format.
Htmlentities: converts all characters into HTML strings.
Implode: converts an array into a string.
Join: converts an array into a string.
Ltrim: removes consecutive white spaces.
Md5: calculate the MD5 of the string.
Nl2br: convert line breaks
.
Ord: returns the ordinal value of a character.
Parse_str: parses the query string into a variable.
Print: output string.
Printf: output the formatted string.
Quoted_printable_decode: convert an qp encoded string to an 8-bit string.
QuoteMeta: add a reference symbol.
Rawurldecode: restores a string from a URL-specific format to a normal string.
Rawurlencode: encode a string into a URL-specific format.
Setlocale: configure the region information.
Similar_text: string similarity calculation.
Soundex: calculates the pronunciation of a string.
Sprintf: format the string.
Strchr: find the first occurrence character.
Strcmp: string comparison.
Strcspns: the length of different strings.
Strip_tags: removes HTML and PHP tags.
StripSlashes: removes the backslash.
Strlen: Gets the string length.
Strrpos: find the last occurrence of a character in the string.
Strpos: searches for the first occurrence of a character in a string.
Strrchr: Gets the string starting from the last occurrence of a character.
Strrev: Reverse string.
Strspns: identifies the number of masks that a string falls into another string.
Strstr: returns the string from the beginning to the end of a string.
Strtok: cut string.
Strtolower: converts all strings to lowercase letters.
Strtoupper: converts all strings to uppercase.
Str_replace: string replacement.
Strtr: converts certain characters.
Substr: obtains some strings.
Trim: removes spaces at the beginning and end of a string.
Ucfirst: uppercase for the first character of the string.
Ucwords: change the first letter of each character in the string to uppercase.
Return value: string
Function type: data processing
Description: This function allows the database to process strings with diagonal lines added to the quotation marks for the database query to operate smoothly. The modified characters include single quotation marks ('), double quotation marks ("), backslash (\), and null character NUL (the null byte ).
Reference: stripslashes () htmlspecialchars () quotemeta ()
Return value: string
Function type: data processing
Description: This function converts a binary string to a hexadecimal string.
Example
Supplement:
The josh@superfork.com (22-jun-1999) writes a function that converts a hexadecimal character into a binary character.
Function hex2bin ($ data ){
$ Len = strlen ($ data );
For ($ I = 0; $ I <$ len; $ I + = 2 ){
$ Newdata. = pack ("C", hexdec (substr ($ string, $ I, 2 )));
}
Return $ newdata;
}
?>
Return value: string
Function type: data processing
Description: This function clears consecutive blank spaces of strings.
Example
$ Trimmed = Chop ($ line );
?>
Reference: trim ()
Return value: string
Function type: data processing
Description: This function converts the ordinal number of characters into ASCII characters. This function is compared with ord.
Example
$ Str. = chr (27 );
$ Str = sprintf ("The End character of the string is % c", 27 );
?>
Reference: ord () sprintf ()
Return value: string
Function type: data processing
Description: This function converts characters into short segments for other functions. For example, base64_encode. It is determined that the chunklen parameter (76 characters) is inserted with end ("\ r \ n") every 76 characters "). Returns a new string without modifying the original string.
Example
Format string $ data into MIME BASE64 format
$ New_string = chunk_split (base64_encode ($ data ));
?>
Reference: ereg_replace ()
Return value: string
Function type: data processing
Content Description: This function converts the ancient Slavic string to another string. THE from and to parameters are characters and their meanings are as follows:
K-koi8-r
Ws-windows-1251
Iso8859-5
A x-cp866
D x-cp866
M-x-mac-cyrillic
Syntax: string crypt (string str, string [salt]);
Return value: string
Function type: encoding
Description: This function encrypts the string with the standard DES module of UNIX. This is a one-way encryption function and cannot be decrypted. To compare the string, place the first two characters of the encrypted string in the salt parameter, and then compare the encrypted string.
For more information, see crypt in UNIX Manual (man.
In some newer UNIX versions, apart from DES, other encryption modules, such as MD5, are provided. Even some systems use MD5 instead of DES. There are still some changes to the salt parameter, depending on the length of the string passed to the salt parameter:
CRYPT_STD_DES-Standard DES encoding, which is a 2-character salt.
CRYPT_EXT_DES-extended DES encoding, which is a 9-character salt.
CRYPT_MD5-MD5 encoding, input 12 characters plus $1 $ salt.
CRYPT_BLOWFISH-extended DES encoding. input 16 characters plus $2 $ salt.
In addition, if the salt parameter is not used, the program will automatically generate it.
Return value: None
Function types: PHP system functions
Description: This function outputs strings. Because it is not a real function, there is no return value.
Example
Echo "Hello World ";
?>
Reference: print () printf () flush ()
Returned value: Array
Function type: data processing
Description: This function is used to cut the string according to the specified string or character separator. Returns the cut string to the array variable.
Example
$ Pizza = "first, second, third, fourth, fifth, and sixth ";
$ Pieces = explode ("", $ pizza );
?>
Reference: implode ()
Return value: None
Function type: data processing
Description: This function has no input or output. Send and clear data in the output buffer.
Syntax: array get_meta_tags (string filename, int [use_include_path]);
Returned value: Array
Function type: data processing
Description: This function includes all Mark the data and place the array variable to return. For example
PHP BIBLE
This function finds out the meta tag. the name attribute string is an array index, while the content attribute string is the content of the array. Note that this function is a PHP native function. on UNIX platforms, you cannot directly process the file format of the Macintosh Tower because the line breaks are different. The blake@mediaone.net points out (07-Jun-1999) that the filename parameter can also be a URL and the function will extract the file meta tag from the remote server. When processing functionsMark end, if Tag placed inAnd cannot be processed.
Syntax: string htmlspecialchars (string );
Return value: string
Function type: data processing
Description: This function converts special characters into HTML strings (&....;). The most common use case may be the message board for handling customer messages.
& (And) &
"(Double quotation marks)"
<(Less than) to <
> (Greater than) to>
This function only converts the preceding special characters and does not convert all of them into the ASCII conversion defined in HTML.
Example
This is an example provided by aulbach@unter.franken.de (27-Jan-1999)
Reference: htmlentities () nl2br ()
Syntax: string htmlentities (string );
Return value: string
Function type: data processing
Description: This function is a bit like the htmlspecialchars () function, but this function converts all the characters in string to special character set strings in HTML. However, there will be a lot of troubles in reading the source code of the webpage after conversion, especially when the text in the source code of the webpage becomes invisible to the cloud, and what the browser sees is still normal.
Return value: string
Function type: data processing
Description: This function combines the content of the array into a string. the glue parameter is the delimiter between words.
Example
$ Colon_separated = implode (":", $ array );
Echo $ colon_separated;
?>
Reference: explode () join () split ()
Return value: string
Function type: data processing
Description: This function is the alias of The implode function.
Return value: string
Function type: data processing
Description: This function is used to delete consecutive white spaces in a string ).
Syntax: string md5 (string str );
Return value: string
Function type: encoding
Description: This function is used to calculate MD5. For details about the MD5 encoding method, refer to RSA Data Security, Inc. MD5 Message-Digest Algorithm. RFC1321; or modern cryptography and its applications, such as laxisong, Han Liang, and Zhang sincerely, 11.3.
Syntax: string nl2br (string );
Return value: string
Function type: data processing
Content Description: This function converts line breaks into HTML lines.
Command.
Reference: htmlspecialchars () htmlentities ()
Return value: integer
Function type: data processing
Description: This function returns the ASCII (American National Standard exchange code) sequence value of the character. This function is opposite to the chr () function.
Example
If (ord ($ str) = 10 ){
Echo ("The first character of string \ $ str is a line break character. \ N ");
}
?>
Reference: chr ()
Syntax: void parse_str (string str );
Return value: None
Function type: data processing
Description: This function parses the QUERY_STRING string of The GET method returned by the browser. The returned variable name and value are based on the name and value of QUERY_STRING.
Example
$ Str = "first = value & second [] = this + works & second [] = another ";
Parse_str ($ str );
Echo $ first; // The "value" string is displayed.
Echo $ second [0]; // display the "this works" string
Echo $ second [1]; // display the "another" string
?>
Return value: Boolean
Function type: data processing
Description: the output string of this function. If the call succeeds, 1 is returned. if the call fails, 0 is returned. For example, if the client's browser suddenly fails during transmission, the output may fail.
Reference: echo () printf () flush ()
Return value: integer
Function type: data processing
Description: This function formats strings according to the content format specified by the parameter format. For details about the format, see sprintf ().
Reference: print () sprintf () flush ()
Syntax: string quoted_printable_decode (string str );
Return value: string
Function type: encoding
Description: This function decodes the quoted-printable string into an 8-bit encoded string. This function is similar to the imap_qprint () function. The only difference is that the imap_qprint () function requires the system to be added to the IMAP module, and this function does not need the IMAP module.
Return value: string
Function type: data processing
Description: This function will contain. \ + *? [^] ($) And other characters are preceded by the backslash "\" symbol.
Reference: addslashes () htmlentities () htmlspecialchars () nl2br () stripslashes ()
Syntax: string rawurldecode (string str );
Return value: string
Function type: encoding
Description: This function decodes strings. Parses the string from the special format of the URL into a normal string. For detailed encoding and decoding information and specification files, refer to RFC 1738.
Reference: rawurlencode ()
Syntax: string rawurldecode (string str );
Return value: string
Function type: encoding
Description: This function encodes a string into a special URL string format. special characters are converted into a percent sign followed by two sixteen digits. For example, the space is changed to % 20.
Example
Echo '';
?>
Reference: rawurldecode ()
Bytes. Bin2hex: binary to hexadecimal. Chop: removes consecutive gaps. Chr: returns the character of the ordinal value. Chunk_split: splits a string into segments. Convert...