Guest User

Untitled

a guest
Jul 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. $str = "Please join me in this prayer. ��❤️";
  2. $newStr = preg_replace_callback("/&#.....;&#.....;/", function($matches){return convertToEmoji($matches);}, $str);
  3. print_r($newStr);
  4. function convertToEmoji($matches){
  5. $newStr = $matches[0];
  6. $newStr = str_replace("&#", '', $newStr);
  7. $newStr = str_replace(";", '##', $newStr);
  8. $myEmoji = explode("##", $newStr);
  9. $newStr = dechex($myEmoji[0]) . dechex($myEmoji[1]);
  10. $newStr = hex2bin($newStr);
  11. return iconv("UTF-16BE", "UTF-8", $newStr);
  12. }
Add Comment
Please, Sign In to add comment