ctype_space ( $text );
此函数检查提供的字符串text中的所有字符是否创建空格。
Sr.No | Parameter & Description |
---|---|
1 |
text(必需) 匹配字符串。 |
如果文本中的每个字符都创建了某种类型的空白,则返回TRUE,否则返回FALSE。除了空白字符外,这还包括制表符、垂直制表符、换行符、回车符和换页符。
<?php $strings=array('\n\r\t', '\test123' ); foreach ($strings as $test) { if (ctype_space($test)) { echo "$test consists of all whitespace characters.\n"; }else { echo "$test does not have all whitespace characters.\n"; } } ?>
这将产生以下输出-
\n\r\t does not have all whitespace characters. \test123 does not have all whitespace characters.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)