How to distinguish Simplified Chinese, Traditional Chinese, Japanese, Korean in php
高洛峰
高洛峰 2017-05-24 11:33:59
0
3
445

How does php distinguish between Simplified Chinese, Traditional Chinese, Japanese and Korean

According to the methods given on the Internet, it seems that Chinese, Japanese, and Korean can be distinguished, but how to distinguish simplified and traditional Chinese?

        $s = <<<'EOF'
"memolov 爱书 愛書 あいしょ 사랑 때문에 책이 되다",
EOF;
        echo $s.PHP_EOL;
        if(preg_match_all('/([\x{4e00}-\x{9fa5}]+)/u',$s,$m)){  //中文简体繁体
            echo "<pre>";
            print_r($m[1]);
            echo "</pre>";
        }

        if(preg_match_all('/([\x{0800}-\x{4e00}]+)/u',$s,$m)){ //日文
            echo "<pre>";
            print_r($m[1]);
            echo "</pre>";
        }
        if(preg_match_all('/([\x{AC00}-\x{D7A3}]+)/u',$s,$m)){  //韩文
            echo "<pre>";
            print_r($m[1]);
            echo "</pre>";
        }
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!