PHP头条
热点:

phpsplit汉字


第一种办法:
加载 Encode模块,前提是你需要安装这个模块
例子代码:
代码如下:
$str=decode("gb2312",$names[$index]);
@chars=split(//,$str);
foreach(@chars)
{
$char=encode("gb2312",$_);
print "ONE WORD:$char\n";
}

第二种办法:
中文字符是占了2个字节,所以你可以用下面语句直接得到汉字,代码如下:
@chars=split(//,$names[$index]);
$str=$chars[0].$chars[1];

www.phpzy.comtrue/php/9307.htmlTechArticlephpsplit汉字 第一种办法: 加载 Encode模块,前提是你需要安装这个模块 例子代码: 代码如下: $str=decode("gb2312",$names[$index]); @chars=split(//,$str); foreach(@chars) { $char=encode("gb2312",$_); print "ONE...

相关文章

相关频道:

PHP之友评论

今天推荐