PHP中的ctype_upper()函数
PHP中的ctype_upper()函数检查大写字符。如果文本中的每个字符在当前语言环境中均为大写字母,则返回TRUE。
语法
ctype_upper(str)
参数
str-测试的字符串
返回
如果文本中的每个字符在当前语言环境中均为大写字母,则ctype_upper()函数将返回TRUE。
示例
以下是一个例子-
<?php
$arr = array('9898jjhh', 'PQR', 'Amit');
foreach ($arr as $demo) {
if (ctype_upper($demo)) {
echo "$demo has all uppercase letters. \n";
} else {
echo "$demo does not have all uppercase letters. \n";
}
}
?>输出结果
以下是输出-
9898jjhh does not have all uppercase letters. PQR has all uppercase letters. Amit does not have all uppercase letters.
示例
让我们看另一个例子-
<?php
$str = 'AUSTRALIA';
if (ctype_upper($str)) {
echo "Word has all uppercase characters!\n";
} else {
//如果为False,则返回No-
echo "Word does not have all uppercase characters!\n";
}
?>输出结果
以下是输出-
Word has all uppercase characters!
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短