(PHP 7 >= 7.2.0, PHP 8)
mb_ord — Get Unicode code point of character
$string, ?string $encoding = null): int|falseReturns the Unicode code point value of the given character.
This function complements mb_chr().
stringA string
encodingencoding
參數(shù)為字符編碼。如果省略或是 null,則使用內(nèi)部字符編碼。
The Unicode code point for the first character of string 或者在失敗時(shí)返回 false.
| 版本 | 說(shuō)明 |
|---|---|
| 8.0.0 |
現(xiàn)在 encoding 可以為 null。
|
<?php
var_dump(mb_ord("A", "UTF-8"));
var_dump(mb_ord("??", "UTF-8"));
var_dump(mb_ord("\x80", "ISO-8859-1"));
var_dump(mb_ord("\x80", "Windows-1252"));
?>
以上例程會(huì)輸出: