复制代码 代码如下:
<?
function pykey( $py_key)
{
$pinyin = 65536 + pys($py_key);
if ( 45217 <= $pinyin && $pinyin <= 45252 )
{
$zimu = "A";
return $zimu;
}
if ( 45253 <= $pinyin && $pinyin <= 45760 )
{
$zimu = "B";
return $zimu;
}
if ( 45761 <= $pinyin && $pinyin <= 46317 )
{
$zimu = "C";
return $zimu;
}
if ( 46318 <= $pinyin && $pinyin <= 46825 )
{
$zimu = "D";
return $zimu;
}
if ( 46826 <= $pinyin && $pinyin <= 47009 )
{
$zimu = "E";
return $zimu;
}
if ( 47010 <= $pinyin && $pinyin <= 47296 )
{
$zimu = "F";
return $zimu;
}
if ( 47297 <= $pinyin && $pinyin <= 47613 )
{
$zimu = "G";
return $zimu;
}
if ( 47614 <= $pinyin && $pinyin <= 48118 )
{
$zimu = "H";
return $zimu;
}
if ( 48119 <= $pinyin && $pinyin <= 49061 )
{
$zimu = "J";
return $zimu;
}
if ( 49062 <= $pinyin && $pinyin <= 49323 )
{
$zimu = "K";
return $zimu;
}
if ( 49324 <= $pinyin && $pinyin <= 49895 )
{
$zimu = "L";
return $zimu;
}
if ( 49896 <= $pinyin && $pinyin <= 50370 )
{
$zimu = "M";
return $zimu;
}
if ( 50371 <= $pinyin && $pinyin <= 50613 )
{
$zimu = "N";
return $zimu;
}
if ( 50614 <= $pinyin && $pinyin <= 50621 )
{
$zimu = "O";
return $zimu;
}
if ( 50622 <= $pinyin && $pinyin <= 50905 )
{
$zimu = "P";
return $zimu;
}
if ( 50906 <= $pinyin && $pinyin <= 51386 )
{
$zimu = "Q";
return $zimu;
}
if ( 51387 <= $pinyin && $pinyin <= 51445 )
{
$zimu = "R";
return $zimu;
}
if ( 51446 <= $pinyin && $pinyin <= 52217 )
{
$zimu = "S";
return $zimu;
}
if ( 52218 <= $pinyin && $pinyin <= 52697 )
{
$zimu = "T";
return $zimu;
}
if ( 52698 <= $pinyin && $pinyin <= 52979 )
{
$zimu = "W";
return $zimu;
}
if ( 52980 <= $pinyin && $pinyin <= 53640 )
{
$zimu = "X";
return $zimu;
}
if ( 53689 <= $pinyin && $pinyin <= 54480 )
{
$zimu = "Y";
return $zimu;
}
if ( 54481 <= $pinyin && $pinyin <= 62289 )
{
$zimu = "Z";
return $zimu;
}
$zimu = $py_key;
return $zimu;
}
function pys( $pysa )
{
$pyi = "";
$i= 0;
for ( ; $i < strlen( $pysa ); $i++)
{
$_obfuscate_8w= ord( substr( $pysa,$i,1) );
if ( 160 < $_obfuscate_8w)
{
$_obfuscate_Bw = ord( substr( $pysa, $i++, 1 ) );
$_obfuscate_8w = $_obfuscate_8w * 256 + $_obfuscate_Bw - 65536;
}
$pyi.= $_obfuscate_8w;
}
return $pyi;
}
$letter = pykey("中华人民共和国");
echo $letter;
?>
<?
function pykey( $py_key)
{
$pinyin = 65536 + pys($py_key);
if ( 45217 <= $pinyin && $pinyin <= 45252 )
{
$zimu = "A";
return $zimu;
}
if ( 45253 <= $pinyin && $pinyin <= 45760 )
{
$zimu = "B";
return $zimu;
}
if ( 45761 <= $pinyin && $pinyin <= 46317 )
{
$zimu = "C";
return $zimu;
}
if ( 46318 <= $pinyin && $pinyin <= 46825 )
{
$zimu = "D";
return $zimu;
}
if ( 46826 <= $pinyin && $pinyin <= 47009 )
{
$zimu = "E";
return $zimu;
}
if ( 47010 <= $pinyin && $pinyin <= 47296 )
{
$zimu = "F";
return $zimu;
}
if ( 47297 <= $pinyin && $pinyin <= 47613 )
{
$zimu = "G";
return $zimu;
}
if ( 47614 <= $pinyin && $pinyin <= 48118 )
{
$zimu = "H";
return $zimu;
}
if ( 48119 <= $pinyin && $pinyin <= 49061 )
{
$zimu = "J";
return $zimu;
}
if ( 49062 <= $pinyin && $pinyin <= 49323 )
{
$zimu = "K";
return $zimu;
}
if ( 49324 <= $pinyin && $pinyin <= 49895 )
{
$zimu = "L";
return $zimu;
}
if ( 49896 <= $pinyin && $pinyin <= 50370 )
{
$zimu = "M";
return $zimu;
}
if ( 50371 <= $pinyin && $pinyin <= 50613 )
{
$zimu = "N";
return $zimu;
}
if ( 50614 <= $pinyin && $pinyin <= 50621 )
{
$zimu = "O";
return $zimu;
}
if ( 50622 <= $pinyin && $pinyin <= 50905 )
{
$zimu = "P";
return $zimu;
}
if ( 50906 <= $pinyin && $pinyin <= 51386 )
{
$zimu = "Q";
return $zimu;
}
if ( 51387 <= $pinyin && $pinyin <= 51445 )
{
$zimu = "R";
return $zimu;
}
if ( 51446 <= $pinyin && $pinyin <= 52217 )
{
$zimu = "S";
return $zimu;
}
if ( 52218 <= $pinyin && $pinyin <= 52697 )
{
$zimu = "T";
return $zimu;
}
if ( 52698 <= $pinyin && $pinyin <= 52979 )
{
$zimu = "W";
return $zimu;
}
if ( 52980 <= $pinyin && $pinyin <= 53640 )
{
$zimu = "X";
return $zimu;
}
if ( 53689 <= $pinyin && $pinyin <= 54480 )
{
$zimu = "Y";
return $zimu;
}
if ( 54481 <= $pinyin && $pinyin <= 62289 )
{
$zimu = "Z";
return $zimu;
}
$zimu = $py_key;
return $zimu;
}
function pys( $pysa )
{
$pyi = "";
$i= 0;
for ( ; $i < strlen( $pysa ); $i++)
{
$_obfuscate_8w= ord( substr( $pysa,$i,1) );
if ( 160 < $_obfuscate_8w)
{
$_obfuscate_Bw = ord( substr( $pysa, $i++, 1 ) );
$_obfuscate_8w = $_obfuscate_8w * 256 + $_obfuscate_Bw - 65536;
}
$pyi.= $_obfuscate_8w;
}
return $pyi;
}
$letter = pykey("中华人民共和国");
echo $letter;
?>
标签:
PHP,提取,中文首字母
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“PHP提取中文首字母”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。