mb_regex_encoding(‘UTF-8’);
if (preg_match(“/^[ぁ-んー]+$/u”, $str)) {
// ひらがな
} else if (preg_match(“/^[ァ-ヶー]+$/u”, $str)) {
// カタカナ
} else if (preg_match(“/^[一-龠]+$/u”, $str)) {
// 漢字
}
スポンサーリンク
ポーキー(私)の出来事・考え・アイデア・旅の忘備録ブログ
mb_regex_encoding(‘UTF-8’);
if (preg_match(“/^[ぁ-んー]+$/u”, $str)) {
// ひらがな
} else if (preg_match(“/^[ァ-ヶー]+$/u”, $str)) {
// カタカナ
} else if (preg_match(“/^[一-龠]+$/u”, $str)) {
// 漢字
}