function chinese_only($arg_strContent)
{
    $blnChineseOnly= true;
    $intLoopCount = 0;
    $intContentLength = strlen($arg_strContent);
    while ($intLoopCount < $intContentLength)
    {
        $chrSingle = substr($arg_strContent,$intLoopCount,1);    
        if(ord($chrSingle) > 0x80) 
        {    
            $chrSingle = substr($arg_strContent,$intLoopCount,2);            
            $intLoopCount++;    
            if(!isBig5($chrSingle))
            {
                $blnChineseOnly = false;
                break;
            }            
        }
        else
        {
            $blnChineseOnly = false;
            break;
        }
        $intLoopCount++;
        
    }      
    return !$blnChineseOnly;
}
function isBig5($char="")
{
    $bc  = hexdec(bin2hex($char));
    if(($bc>=0xa440 && $bc<= 0xc67e)||($bc>=0xc940 && $bc<= 0xf9dc))
    {
        return true;
    }
    else
    {
        return false;
    }
}
 
沒有留言:
張貼留言