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

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

WBOY
Release: 2016-06-23 13:07:57
Original
1967 people have browsed it

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



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


回复讨论(解决方案)

根据其内码判断

$s = <<<'EOF'"memolov 爱书 愛書 あいしょ 사랑 때문에 책이 되다",EOF;if(preg_match_all('/([\x{4e00}-\x{9fa5}]+)/u',$s,$m)){	echo "<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">";	print_r($m[1]);	echo "
Copy after login
Copy after login
Copy after login
";}if(preg_match_all('/([\x{0800}-\x{4e00}]+)/u',$s,$m)){ echo "
";	print_r($m[1]);	echo "
Copy after login
Copy after login
";}if(preg_match_all('/([\x{AC00}-\x{D7A3}]+)/u',$s,$m)){ echo "
";	print_r($m[1]);	echo "
Copy after login
Copy after login
";}/*Array( [0] => 爱书 [1] => 愛書)Array( [0] => あいしょ)Array( [0] => 사랑 [1] => 때문에 [2] => 책이 [3] => 되다)*/

source:php.cn
Previous article:ecshop导出excel数据 Next article:PHP 简单方法
Statement of this Website
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
Latest Articles by Author
Latest Issues
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template