6

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
qwertymk
  • 34,200
  • 28
  • 121
  • 184

2 Answers2

9

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

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
-1

Look at this: http://php.net/manual/en/function.utf8-encode.php

Francisc
  • 77,430
  • 63
  • 180
  • 276