Chinese-Character-pattern

Aug 31, 2014

I found this useful php code snippet on the internet.
And post here for future use and remind.

1
2
3
4
5
6
7
8
9
<?php
function checkChineseCharater($str){
	if (preg_match("/^[\x{4e00}-\x{9fa5}]+$/u",$str)) {
		return true;
	} else {
		return false;
	}
}
?>

gist here:

Do Not Remain Silent

Back To Top