欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php中文转拼音的代码,_PHP教程

程序员文章站 2022-05-10 13:26:12
...

php中文转拼音的代码,

='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; $i160) { $_Q = ord(substr($_String, ++$i, 1)); $_P = $_P*256 + $_Q - 65536; }
$_Res .= _Pinyin($_P, $_Data);
}
return preg_replace("/[^a-z0-9]*/", '', $_Res);
}
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);
}
function _Array_Combine($_Arr1, $_Arr2)
{
for($i=0; $i

  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1087041.htmlTechArticlephp中文转拼音的代码, ?php/*** php中文转拼音* 整理:www.jbxue.com 脚本学堂* 日期:2014/2/11*/function Pinyin($_String, $_Code='gb2312'){$_DataKey = "a|ai|an...