Last active
September 7, 2016 05:20
-
-
Save GiancarloGomez/e62928a665ef796464137bafc6cb20ec to your computer and use it in GitHub Desktop.
Clean Emoji using PHP. Making this call from ColdFusion can be seen here https://gist.github.com/GiancarloGomez/0e76348c89df8f3b72fddfe7843cbceb The PHP snippet was taken from here https://www.drupal.org/node/2043439 (http://www.giancarlogomez.com/2016/09/emoji-support-with-coldfusion-and-mysql.html)
This file contains 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) { | |
$clean_text = ""; | |
// Match Emoticons | |
$regexEmoticons = '/[\x{1F600}-\x{1F64F}]/u'; | |
$clean_text = preg_replace($regexEmoticons, '', $text); | |
// Match Miscellaneous Symbols and Pictographs | |
$regexSymbols = '/[\x{1F300}-\x{1F5FF}]/u'; | |
$clean_text = preg_replace($regexSymbols, '', $clean_text); | |
// Match Transport And Map Symbols | |
$regexTransport = '/[\x{1F680}-\x{1F6FF}]/u'; | |
$clean_text = preg_replace($regexTransport, '', $clean_text); | |
return $clean_text; | |
} | |
echo isset($_POST['value']) ? removeEmoji($_POST['value']) : ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment