PHP determines whether the string contains Chinese characters

Source: Internet
Author: User
: This article mainly introduces PHP to determine whether the string contains Chinese characters. if you are interested in the PHP Tutorial, refer to it. Refer: http://www.wilf.cn/post/php-match-chinese-str.html

Since the black hat SEO, SPAM has always been one of the work content of website staff. We are not banned from spam message sending machines or spam user registration machines.

Determining whether a string contains Chinese characters is one of the ways to deal with SPAM. it can effectively block SPAM messages in English only and regulate user registration. The following code is compatible with gb2312 and UTF-8.

Additional, double byte character encoding range

1. GBK (GB2312/GB18030)
\ X00-\ xff GBK dubyte encoding range
\ X20-\ x7f ASCII
\ Xa1-\ xff Chinese gb2312
\ X80-\ xff Chinese gbk

2. UTF-8 (Unicode)
\ U4e00-\ u9fa5 (Chinese)
\ X3130-\ x318F (Korean
\ XAC00-\ xD7A3 (Korean)
\ U0800-\ u4e00 (Japanese )*/


The above introduces PHP to determine whether the string contains Chinese characters, including content, and hope to be helpful to friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.