PHP中的ctype_punct()函数
ctype_punct()函数检查不是空格或字母数字字符的任何可打印字符。
语法
ctype_punct(str)
参数
str-测试的字符串
返回
如果文本中的每个字符都是可打印的,则ctype_punct()函数将返回TRUE,但字母,数字或空格均不可打印,否则返回FALSE。
示例
以下是一个例子-
<?php
$srr = array('k211!@!$#', 'foo!#$bar', '*$()');
foreach ($srr as $d) {
if (ctype_punct($d)) {
echo "$d consists of all punctuation. \n";
} else {
echo "$d does not have all punctuation. \n";
}
}
?>输出结果
以下是输出-
k211!@!$# does not have all punctuation. foo!#$bar does not have all punctuation. *$() consists of all punctuation.
热门推荐
10 香港老妈结婚祝福语简短
11 毕业立体贺卡祝福语简短
12 简短新年年会祝福语
13 评论小品祝福语大全简短
14 恭喜师兄结婚祝福语简短
15 员工集体辞职祝福语简短
16 高中新生祝福语 简短
17 装修祝福语男生搞笑简短
18 生日开业蛋糕祝福语简短