ctype_lower() 函数检测字符串中字符是否都为小写字母。
ctype_lower ( $text );
此函数检查提供的字符串,文本中的所有字符是否均为小写字母。
| 序号 | 参数及说明 |
|---|---|
| 1 | text(必需) 被测试的字符串。 |
如果文本中的每个字符在当前语言环境中均为小写字母,则返回TRUE。
检测字符是否均为小写字母。
<?php
$strings = array('aac123', 'testing', "testin IS Done");
foreach ($strings as $test) {
if (ctype_lower($test)) {
echo "$test 全部为小写字母。 \n";
}else {
echo "$test 含有不为小写字母或字符。 \n";
}
}
?>测试看看‹/›输出结果:
aac123 含有不为小写字母或字符。 testing 全部为小写字母。 testin IS Done 含有不为小写字母或字符。