php 汉语言拼音 可以只首字母,也可以设utf8,gbk
程序员文章站
2024-01-06 10:39:10
...
php 中文拼音 可以只首字母,也可以设utf8,gbk
='5.0') ? array_combine($_tdatakey, $_tdatavalue) : _array_combine($_tdatakey, $_tdatavalue);arsort($_data);reset($_data);if($_code != 'gb2312') $_string = _u2_utf8_gb($_string);$_res = '';for($i=0; $i?160) { $_q = ord(substr($_string, ++$i, 1)); $_p = $_p*256 + $_q - 65536; }$_res .= _pinyin($_p, $_data,$isinitial);}return preg_replace("/[^a-z0-9]*/", '', $_res);}function _pinyin($_num, $_data,$isinitial){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);}function _array_combine($_arr1, $_arr2){for($i=0; $i
相关文章
相关视频