Domanda

Is there a PHP function that takes an integer and return the Unicode character of that number?

È stato utile?

Soluzione

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

Altri suggerimenti

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top