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.
热门推荐
4 贫困户祝福语简短
10 孙子结婚祝福语大全简短
11 合字的祝福语简短
12 好听的元旦简短祝福语
13 写给男生简短的祝福语
14 中考祝福语简短卡片大全
15 新年简短的祝福语爱情
16 职场祝福语大全 简短精辟
17 老师出国祝福语大全简短
18 新生祝福语简短8字