Created
October 26, 2016 09:45
-
-
Save Restoration/2c9c9760a311ea9c77256342c28a6444 to your computer and use it in GitHub Desktop.
CakePHP カタカナチェック
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 | |
| /** | |
| * 全角カタカナ以外が含まれていればエラーとするバリデーションチェック | |
| * | |
| * | |
| * @param array &$model | |
| * @param array $wordvalue | |
| * @return boolean | |
| */ | |
| function katakana_only( $wordvalue){ | |
| $value = array_shift($wordvalue); | |
| return preg_match("/^[ァ-ヶー゛゜]*$/u", $value); // カタカナ | |
| //return preg_match("/^[ァ-ヶー゛゜]*$/u", $value); // スペースも含むカタカナ | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment