Skip to content

Instantly share code, notes, and snippets.

@AmgedOsman
Forked from quantizer/removeEmoji.php
Created March 19, 2016 22:35
Show Gist options
  • Save AmgedOsman/ab424f0b3ff2a7cf09bf to your computer and use it in GitHub Desktop.
Save AmgedOsman/ab424f0b3ff2a7cf09bf to your computer and use it in GitHub Desktop.
function removeEmoji($text)
{
$cleanText = "";
// Match Emoticons
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u';
$cleanText = preg_replace($regexEmoticons, '', $text);
// Match Miscellaneous Symbols and Pictographs
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u';
$cleanText = preg_replace($regexSymbols, '', $cleanText);
// Match Transport And Map Symbols
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u';
$cleanText = preg_replace($regexTransport, '', $cleanText);
return $cleanText;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment