ASCII (American Standard Code for information Interchange, US Information Interchange standards codes) is a computer coding system based on the Latin alphabet, mainly used to display modern English and other Western European languages. It is now the most versatile single-byte encoding system and is equivalent to ISO/IEC 646.
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