PHP汉字转换拼音
程序员文章站
2022-03-08 13:38:27
...
='5.0') ? array_combine($_TDataKey, $_TDataValue) : $this->Arr_Combine($_TDataKey, $_TDataValue); arsort($_Data); reset($_Data); if($_Code != 'gb2312') $_String = $this->U2_Utf8_Gb($_String); $_Res = ''; for($i=0; $i160) { $_Q = ord(substr($_String, ++$i, 1)); $_P = $_P*256 + $_Q - 65536; } $_Res .= $this->Pinyins($_P, $_Data); } return $_Res; //return preg_replace("/[^a-z0-9]*/", '', $_Res); } function Pinyins($_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); } function Arr_Combine($_Arr1, $_Arr2){ for($i=0; $i Pinyin(' 中 华 人 民','UTF8'); ?>
上一篇: iis6如何安装php
下一篇: PHP自毁程序–私活的必备良嫔