Created
January 16, 2012 11:49
-
-
Save violetyk/1620516 to your computer and use it in GitHub Desktop.
[php]pregでカナチェックしてみた
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$kana = array( | |
'アイウエオ', | |
'カキクケコ', | |
'サシスセソ', | |
'タチツテト', | |
'ナニヌネノ', | |
'ハヒフヘホ', | |
'マミムメモ', | |
'ヤユヨ', | |
'ラリルレロ', | |
'ワヲン', | |
'ガギグゲゴ', | |
'ザジズゼゾ', | |
'ダヂヅデド', | |
'バビブベボ', | |
'パピプペポ', | |
'ァィゥェォ', | |
'ヵヶ', | |
'ャュョ', | |
'ヴー', | |
// 'ヰヱヷヸヹヺ', | |
'アイウエオ', | |
'カキクケコ', | |
'サシスセソ', | |
'タチツテト', | |
'ナニヌネノ', | |
'ハヒフヘホ', | |
'マミムメモ', | |
'ヤユヨ', | |
'ラリルレロ', | |
'ワヲン', | |
'゙゚', | |
'ァィゥェォ', | |
'ー', | |
); | |
foreach ($kana as $line) { | |
if (!preg_match('/^[ァ-ヶーヲ-゚]+$/u', $line)) { | |
echo 'NG:' . $line; | |
exit(); | |
} | |
} | |
echo '全部ok!'; | |
echo '<pre>'; | |
print_r($kana); | |
echo '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment