fromCharCode的PHP等价物是什么? [英] What is the PHP equivlent of fromCharCode?
本文介绍了fromCharCode的PHP等价物是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一个采用整数并返回该数字的Unicode字符的PHP函数?
Is there a PHP function that takes an integer and return the Unicode character of that number?
推荐答案
否,但是您可以轻松地制作一个:
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');
}
?>
来自: PHP手册-hr-注释
Taken from: PHP Manual - chr - comments
这篇关于fromCharCode的PHP等价物是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文