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 好听的元旦简短祝福语