ctype_punct() - 语法
ctype_punct ( $text );
此函数检查提供的字符串text中的所有字符是否都是标点符号。
| Sr.No | Parameter & Description |
|---|---|
| 1 |
text(必需) 匹配字符串。 |
ctype_punct() - 返回值
如果文本中的每个字符都是可打印的,则返回TRUE,但既不是字母、数字也不是空白,否则返回FALSE。
ctype_punct() - 示例
<?php $strings=array(k211!@!0, foo!#, *); foreach ($strings as $test) { if (ctype_punct($test)) { echo "$test consists of all punctuation.\n"; }else { echo "$test does not have all punctuation.\n"; } } ?>
这将产生以下输出-
k211!@!$# does not have all punctuation. foo!#$bar does not have all punctuation. *$() consists of all punctuation.