One, the Universal ASCII code table
graphic ASCII code comparison chart , with character A as an example
Dec denotes decimal, such as 65
HX denotes hexadecimal, such as 41
The OCT represents octal, such as 101
Char represents a display character, such as a
ASCII code comparison chart is divided into two units
1, control characters 0-31 and 127
2, can display character 32-126
(1) The 48~57 is 0 to 90 Arabic numerals;
(2) 65~90 for 26 uppercase English letters;
(3) The 97~122 number is 26 lowercase English letters;
(4) Other punctuation, arithmetic symbols, etc.;
Two, ASCII extension code table
Three, PHP character conversion function description
For a description of the specific character conversion function, refer to [PHP Functions in detail decimal, binary, octal, and 16 binary conversion function Descriptions]
Decimal to Binary decbin () function
Decimal to octal decoct () function
Decimal to hexadecimal dechex () function
Binary turn 16 into Bin2Hex () function
Binary turn 10 into Bindec () function
Octal decimal octdec () function
hexadecimal to decimal hexdec () function
Arbitrary binary conversion Base_convert () function
Character Conversion Instance
instance One, how to convert a character to binary, octal, or hex, you can use the Ord () function to convert a character to an ASCII value and then convert it using the corresponding conversion function, as follows
A this character is converted to binary/eight binary/16, as follows
The decimal of the A character: Ord (' a '); Output 97
Binary: Decbin (Ord (' A ')); Output 1100001
Octal: Decoct (Ord (' A ')); Output 141
Hex: Dechex (Ord (' A ')); Output 61
You can then check the results of each input output corresponding to the above ASCII code comparison chart.
Example Two, how to convert a binary to 16 binary or decimal, such as the binary of a, as follows
Using instance one method to get the binary of a character
Decbin (Ord (' A '));
Then convert the binary to 16 decimal or binary
Hex: Bin2Hex (Decbin (Ord (' a)));//Output 31313030303031
Binary J:bindec (Decbin (Ord (' A '))); Output 97
The Ord () function discussed above will be discussed in detail in the next installment of the text character encoding Study series.
Four, references
PHP functions Description of decimal, binary, octal, and 16 binary conversion functions
PHP bulk ASCII-to-string
Asciitable Comparison Chart
Wikipedia ASCII
Baidu Encyclopedia ASCII
The above is the PHP detailed ASCII code table and character conversion content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!
Http://www.bkjia.com/PHPjc/324716.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324716.htmlTechArticle One, A common ASCII code comparison chart of the ASCII Code table diagram, with the character A as an example Dec represents a decimal, such as the number of HX is hexadecimal, such as the OCT represents octal, such as 101 char represents the display word ...