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!
热门推荐
1 带狗狗训练
4 听力训练狗狗
6 怎训练狗狗
7 腹肌训练狗狗
8 网球训练狗狗
9 记叙文训练狗狗
10 狗狗太凶怎么训练
11 核心力量训练狗狗
12 狗狗乱叫怎么训练
13 发音训练狗狗
14 怎么训练狗狗叼东西给主人
15 荆州训练狗狗
16 篮球训练狗狗
17 做训练狗狗
18 训练狗狗坐姿