How can I convert a string from \uD83D\uDE00
to full \U0001f603
?
json_encode()
only converts to the first option...
$str = '😃';
$encode = json_encode($str);
var_dump($encode);
// string(14) ""\ud83d\ude03""
Assuming you have the Intl
extension installed, this is easy enough to do with one of its built-in transliterators:
<?php
$str = "😀";
echo transliterator_create("Any-Hex/C")->transliterate($str);
Output:
\U0001F603