如何在 php 中获取波斯语和阿拉伯语字符
How to get Persian And Arabic Characters in php
我想从波斯语字符中获取 Ascii 码。
我的代码:
<?php
header ('Content-Type: text/html; charset=UTF-8');
$Char = "س"; // This is a Persian Character
echo ord($Char); // Output: 216
echo ord(utf8_encode($Char)); // Output: 195
// The Real Code Of This Character: 1587
?>
您可以使用 mb_ord() 来获取多字节字符的代码点:
$Char = "س"; // This is a Persian Character
echo mb_ord($Char); // Output: 1587
我想从波斯语字符中获取 Ascii 码。
我的代码:
<?php
header ('Content-Type: text/html; charset=UTF-8');
$Char = "س"; // This is a Persian Character
echo ord($Char); // Output: 216
echo ord(utf8_encode($Char)); // Output: 195
// The Real Code Of This Character: 1587
?>
您可以使用 mb_ord() 来获取多字节字符的代码点:
$Char = "س"; // This is a Persian Character
echo mb_ord($Char); // Output: 1587