ctype_alpha()函数检查字母字符。如果文本中的每个字符都是字母,则返回TRUE,否则返回FALSE。
ctype_alpha ( $str );
str-测试的字符串
如果文本中的每个字符都是字母,则ctype_alpha()函数返回TRUE,否则返回FALSE。
以下是一个例子-
<?php $str = array('demo', 'de967demo'); foreach ($str as $a) { if (ctype_alpha($a)) { echo "$a consists of all letters. \n"; } else { echo "$a does not have all letters. \n"; } } ?>
输出结果
以下是输出-
demo consists of all letters. de967demo does not have all letters.