This function converts emoji to unicode
function emoji_to_unicode($emoji) {
$emoji = mb_convert_encoding($emoji, 'UTF-32', 'UTF-8');
$unicode = strtoupper(preg_replace("/^[0]+/","U+",bin2hex($emoji)));
return $unicode;
}
usage
$var = ("");
echo emoji_to_unicode($var);
So it returns to me U+1F600
the problem is if I add more emoji on $var
it only returns the first emoji, example of return bellow:
$var = ("");
echo emoji_to_unicode($var);
returns to me U+1F6000001F600
when it should return U+1F600 U+1F600
It works fine when convert a single emoji but not working when convert multiple emojis