Skip to content

Instantly share code, notes, and snippets.

@williameliel
Created June 12, 2014 15:16
Show Gist options
  • Save williameliel/cb0ab92f4803c35c78d9 to your computer and use it in GitHub Desktop.
Save williameliel/cb0ab92f4803c35c78d9 to your computer and use it in GitHub Desktop.

Revisions

  1. williameliel created this gist Jun 12, 2014.
    18 changes: 18 additions & 0 deletions remove emojis
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    function remove_emoji($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;
    }