Php-function-ctype-alpha
提供:Dev Guides
PHP-関数ctype_alpha()
構文
ctype_alpha ( $text );
定義と使い方
指定された文字列、テキスト内のすべての文字がアルファベットかどうかをチェックします。
パラメーター
Sr.No | Parameter & Description |
---|---|
1 |
text(Required) テストされた文字列。 |
戻り値
テキスト内のすべての文字が文字の場合はTRUE、そうでない場合はFALSEを返します。
例
次の例を試してください-
<?php
$strings = array('example', 'example1234');
foreach ($strings as $test) {
if (ctype_alpha($test)) {
echo "$test consists of all letters. \n";
}else {
echo "$test does not have all letters. \n";
}
}
?>
これは、次の結果を生成します-
example consists of all letters.
example1234 does not have all letters.