PHP 去掉emoji字符

    
    function isMatchEmoji($str)
    {
        $pattern='/./u';
        $rs=preg_match_all($pattern,$str,$match);
        if($rs>0){
            foreach($match[0] as $m){
                if(strlen($m) >= 4){
                    return true;
                }
            }            
        }
        return false;
    }
    
    $str='ko👑🎤哈羅';
    $rs=isMatchEmoji($str);
    echo $rs?'have emoji':'not have emoji';
相關文章
相關標籤/搜索