ctype_print ( $text );
此函数检查提供的字符串text中的所有字符是否均可打印。
Sr.No | Parameter & Description |
---|---|
1 |
text(必需) 匹配字符串。 |
如果文本中的每个字符都将实际创建输出(包括空格),则返回true。如果文本包含控制字符或根本不具有任何输出或控制功能的字符,则返回False。
<?php $strings=array('asdf\n\r\t', 'k211', "fooo#int%@"); foreach ($strings as $test) { if (ctype_print($test)) { echo "$test consists of all printable characters.\n"; }else { echo "$test does not have all printable characters.\n"; } } ?>
这将产生以下输出-
asdf\n\r\t consists of all printable characters. k211 consists of all printable characters. fooo#int%@consists of all printable characters.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)