无涯教程-PHP - ctype_cntrl()函数

41 阅读1分钟

ctype_cntrl() - 语法

ctype_cntrl ( $text );

它检查提供的字符串text中的所有字符是否都是控制字符。控制字符是例如换行符、制表符、转义字符。

Sr.No Parameter & Description
1

text(必需)

匹配字符串。

ctype_cntrl() - 返回值

如果文本中的每个字符都是当前区域设置中的控制字符,则返回TRUE,否则返回FALSE。

ctype_cntrl() - 示例

<?php
   $strings=array(

	, example1234r);
   
   foreach ($strings as $test) {
      if (ctype_cntrl($test)) {
         echo "$test consists of all control characters.\n";
      }else {
         echo "$test does not have all all control characters.\n";
      }
   }
?> 

这将产生以下结果-

\n\r\t does not have all all control characters.
example1234r does not have all all control characters.

参考链接

www.learnfk.com/php/php-fun…