• 非Public项目
  • $d
  • _g
选择语言 :

 Core_PinYin::get

null Core_PinYin::get( )
File: ./core/classes/pinyin.class.php
static public function get($str, $charset = 'UTF-8')
{
    if (!$charset || ($charset = strtoupper($charset)) != 'GBK' || $charset != 'GB2312')
    {
        $str = iconv($charset, 'GBK', $str);
    }

    $ret = '';
    for($i = 0; $i < strlen($str); $i ++)
    {
        $p = ord(substr($str, $i, 1));
        if ( $p > 160 )
        {
            $q = ord(substr($str, ++$i, 1));
            $p = $p * 256 + $q - 65536;
        }
        $ret .= PinYIn::_g($p);
    }
    return $ret;
}