PHP 中的 ctype_graph()函数

首页 / PHP入门教程 / PHP 中的 ctype_graph()函数

ctype_graph() - 语法

ctype_graph ( $text );

此函数检查提供的字符串text中的所有字符是否创建可见输出。

Sr.No Parameter & Description
1

text(必需)

匹配字符串。

ctype_graph() - 返回值

如果文本中的每个字符都是可打印的,并且实际创建了可见输出(没有空格),则返回true,否则返回false。

ctype_graph() - 示例

<?php
   $strings=array('asdf\n\r\t', 'arf12', 'LKA#@%.54');
   
   foreach ($strings as $test) {
      if (ctype_graph($test)) {
         echo "$test consists of all (visibly) printable characters\n";
      }else {
         echo "$test does not have all (visibly) printable characters.\n";
      }
   }
?> 

这将产生以下输出-

asdf\n\r\t consists of all (visibly) printable characters.
arf12 consists of all (visibly) printable characters
LKA#@%.54 consists of all (visibly) printable characters

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

微服务架构核心20讲 -〔杨波〕

Service Mesh实战 -〔马若飞〕

职场求生攻略 -〔臧萌〕

跟月影学可视化 -〔月影〕

如何看懂一幅画 -〔罗桂霞〕

WebAssembly入门课 -〔于航〕

跟着高手学复盘 -〔张鹏〕

Web漏洞挖掘实战 -〔王昊天〕

林外 · 专利写作第一课 -〔林外〕

好记忆不如烂笔头。留下您的足迹吧 :)