ctype_alpha ( $text );
它检查提供的字符串text中的所有字符是否都是字母。
Sr.No | Parameter & Description |
---|---|
1 |
text(必需) 匹配字符串。 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-ctype-alpha.html 来源:LearnFk无涯教程网 |
如果文本中的每个字符都是字母,则返回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.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)