Created
December 29, 2018 07:54
-
-
Save sursir/7c2e5f23e7cbe1fc1929de0a3894b6ab to your computer and use it in GitHub Desktop.
php emoji unicode multi-byte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function removeEmoji($text) | |
| { | |
| $cleanText = ""; | |
| // Enclosed characters 24C2 - 1F251 | |
| $regexEnclosed = '/[\x{24C2}-\x{1F251}]/u'; | |
| $cleanText = preg_replace($regexEnclosed, '', $text); | |
| // Dingbats 2702 - 27B0 | |
| $regexDingbats = '/[\x{2702}-\x{27B0}]/u'; | |
| $cleanText = preg_replace($regexDingbats, '', $cleanText); | |
| // Match Miscellaneous Symbols and Pictographs | |
| $regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; | |
| $cleanText = preg_replace($regexSymbols, '', $cleanText); | |
| // Match Emoticons | |
| $regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; | |
| $cleanText = preg_replace($regexEmoticons, '', $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