字符串中中英文夹杂

字符串中中英文夹杂



[Copy to clipboard] [ - ]
CODE:
$aaa = "abc我abcß";

如果是gbk编码,  substr($aaa,3,2)  就能把"我"取出来,但是要是"我"的位置不确定,怎么才能按字符取出这种多字节的字出来?
Encode::encode Encode::decode
use Encode;
$content = "abcabc&#我223;";
$content = Encode::decode_utf8($content);
$content = substr($content, 8, 1);
$content = Encode::encode_utf8($content);
print $content;
ok ,多谢!