Home  >  Article  >  Backend Development  >  php 如何区分中文,日文,韩文,

php 如何区分中文,日文,韩文,

WBOY
WBOYOriginal
2016-06-23 13:07:571910browse

"memolov 爱书 愛書 あいしょ 사랑 때문에 책이 되다",



如何判断一个字是中文,日文韩文,


回复讨论(解决方案)

根据其内码判断

$s = <<<'EOF'"memolov 爱书 愛書 あいしょ 사랑 때문에 책이 되다",EOF;if(preg_match_all('/([\x{4e00}-\x{9fa5}]+)/u',$s,$m)){	echo "<pre class="brush:php;toolbar:false">";	print_r($m[1]);	echo "
";}if(preg_match_all('/([\x{0800}-\x{4e00}]+)/u',$s,$m)){ echo "

";	print_r($m[1]);	echo "
";}if(preg_match_all('/([\x{AC00}-\x{D7A3}]+)/u',$s,$m)){ echo "
";	print_r($m[1]);	echo "
";}/*Array(    [0] => 爱书    [1] => 愛書)Array(    [0] => あいしょ)Array(    [0] => 사랑    [1] => 때문에    [2] => 책이    [3] => 되다)*/
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
Previous article:ecshop导出excel数据Next article:PHP 简单方法