php获取中文的拼音代码_PHP教程
程序员文章站
2024-01-01 11:04:04
...
php获取中文的拼音代码
获取中文的拼音代码
160) { $_Q = ord(substr($chinese, ++$i, 1)); $_P = $_P * 256 + $_Q - 65536; } $result .= ($ucfirst ? ucfirst(self::_pinyin($_P, $data)) : self::_pinyin($_P, $data)); } return preg_replace("/[^a-z0-9]*/i", '', $result); } private static function _pinyin($num, $data) { if ($num > 0 && $num -10247) return ''; else { foreach ($data as $k => $v) { if ($v > 6); $string .= chr(0x80 | $c & 0x3F); } elseif ($c > 12); $string .= chr(0x80 | $c >> 6 & 0x3F); $string .= chr(0x80 | $c & 0x3F); } elseif ($c > 18); $string .= chr(0x80 | $c >> 12 & 0x3F); $string .= chr(0x80 | $c >> 6 & 0x3F); $string .= chr(0x80 | $c & 0x3F); } return iconv('UTF-8', 'GB2312', $string); } } ?>