PHPで全角ひらがなカタカナがあるかを判定
UTF-8のコードにおいて、全角のひらがな、カタカナ、句読点(、。)のどれかが1文字以上あれば真。
$a = array( 'The quick brown fox jumps over the lazy dog.', 'The quick brown fox jumps over the lazy dog. !?#$%&', 'The quick brown fox jumps over the lazy dog. あ', '私名前中野', '私、名前中野', '私名前中野。', '私の名前は中野です' ); foreach ($a as $str) { print $str . " : "; print (preg_match("/[ぁ-ゞァ-ヾ、。]+/u", $str) ? "OK" : "NG") . "\n"; }