ctype_punct ( $text );
此函数检查提供的字符串text中的所有字符是否都是标点符号。
Sr.No | Parameter & Description |
---|---|
1 |
text(必需) 匹配字符串。 |
如果文本中的每个字符都是可打印的,则返回TRUE,但既不是字母、数字也不是空白,否则返回FALSE。
<?php $strings=array('k211!@!$#', 'foo!#$bar', '*$()'); 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.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)