PHP ord () functions the PHP string function defines and uses the Ord () function to return the ASCII value of the first character of a string. The syntax ord (string) parameter describes the string required. The string from which to get the ASCII value.
PHP Tutorial ord () function
PHP string function
Definition and usage
The Ord () function returns the ASCII value of the first character of a string.
Grammar
Ord (String) parameter description
string is required. The string from which to get the ASCII value.
Echo Ord (' I ');
Here can only return 230, I was saved by U8 file and output, it got only 230, and 230 to Hex is E6, actually U8 My code is e68891, so you understand it, in fact, it only got the first byte
echo chr (0xe6) Chr (0x88). chr (0x91);
This example can be u8 in the case of the output of my kanji, you see, here 3 times to get this kanji
A character
$str = (Pack ("A *", "China"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
H character
$str = (Pack ("h*", "Fffe"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
C character
$str = (Pack ("c*", "55", "56", "57"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
I-character short-shaped 32-bit 4-byte 64-bit 8-byte
$str = (Pack ("I", "100"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
s character short shaping 2 bytes
$str = (Pack ("s", "100"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
L character-length shaping 4 bytes
$str = (Pack ("L", "100"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
F-character single-precision floating-point 4 bytes
$str = (Pack ("F", "100"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
D-character double-precision floating-point 8 bytes
$str = (Pack ("D", "100"));
echo $str, "=", strlen ($STR), "Byte n";
Getascill ($STR);
function Getascill ($STR)
{
$arr =str_split ($STR);
foreach ($arr as $v)
{
echo $v, "=", Ord ($v), "n";
}
echo "=============RNRN";
}
http://www.bkjia.com/PHPjc/445403.html www.bkjia.com true http://www.bkjia.com/PHPjc/445403.html techarticle php ord () functions the PHP string function defines and uses the Ord () function to return the ASCII value of the first character of a string. The syntax ord (string) parameter describes the string required. The word from which to get the ASCII value ...