How to convert codepoint of emoji into emoji char in php?

Let suppose we know the codepoint of emoji and want to convert codepoint into emoji char to show in HTML. and we know there are multiple methods are known but all method doesn’t work but Here I have provided the working code in PHP

Let codepoint is 1F64C 1F3FF and want to convert into char emoji then follow the below code

$emoji=$data['COL 5'];
     $emoji_unicode = $emoji; 
     $emoji_html = "";
     $code_points = explode(' ', $emoji_unicode);
     foreach ($code_points as $code_point) {
     $emoji_html .= '&#x' . $code_point . ';';
 $emoji_entity = $emoji_html; 
$emoji_char = mb_convert_encoding($emoji_entity, 'UTF-8', 'HTML-ENTITIES');
echo $emoji_html;

Output of the above code is 🙌🏿

Leave a Comment