Is there a PHP function that takes an integer and return the unicode character of that number?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No, but you can easily make one:
<?php
/**
* Return unicode char by its code
*
* @param int $u
* @return char
*/
function unichr($u) {
return mb_convert_encoding('&#' . intval($u) . ';', 'UTF-8', 'HTML-ENTITIES');
}
?>
Taken from: PHP Manual - chr - comments
回答2:
Look at this: http://php.net/manual/en/function.utf8-encode.php