"pppppp",2=>"他他他",3=>"aaaaa",4=>"你你你")如何将éé转化为英文我的最终目的就是分类成这样.ééopp,pppppp,aaaaa他他他,你你你------解决方案--------------------$a&nbs"/> "pppppp",2=>"他他他",3=>"aaaaa",4=>"你你你")如何将éé转化为英文我的最终目的就是分类成这样.ééopp,pppppp,aaaaa他他他,你你你------解决方案--------------------$a&nbs">

Home >Backend Development >PHP Tutorial >怎么对英文与汉字进行判断

怎么对英文与汉字进行判断

WBOY
WBOYOriginal
2016-06-13 12:00:15893browse

如何对英文与汉字进行判断
如一组数据$a=array(0=>"ééopp",1=>"pppppp",2=>"他他他",3=>"aaaaa",4=>"你你你")

如何将éé转化为英文

我的最终目的就是分类成这样.
ééopp,pppppp,aaaaa

他他他,你你你


------解决方案--------------------

$a = array(0=>"ééopp",1=>"pppppp",2=>"他他他",3=>"aaaaa",4=>"你你你");<br />$t = preg_grep('/\w/', $a);<br />echo join(',', $t), PHP_EOL;<br />echo join(',', array_diff($a, $t));<br />
ééopp,pppppp,aaaaa
他他他,你你你

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn