Get Character by Unicode Code Point using PHP

mbstring extension

  1. Enable extension in php.ini file:
extension=mbstring
  1. Get character by Unicode code point:
<?php

$code = 'U+2122';
$codeDec = hexdec(substr($code, 2));
$character = mb_chr($codeDec);

echo $character; // ™

Leave a Comment

Cancel reply

Your email address will not be published.