Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $str = "Please join me in this prayer. ��❤️";
- $newStr = preg_replace_callback("/&#.....;&#.....;/", function($matches){return convertToEmoji($matches);}, $str);
- print_r($newStr);
- function convertToEmoji($matches){
- $newStr = $matches[0];
- $newStr = str_replace("&#", '', $newStr);
- $newStr = str_replace(";", '##', $newStr);
- $myEmoji = explode("##", $newStr);
- $newStr = dechex($myEmoji[0]) . dechex($myEmoji[1]);
- $newStr = hex2bin($newStr);
- return iconv("UTF-16BE", "UTF-8", $newStr);
- }
Add Comment
Please, Sign In to add comment