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

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

技术教程推荐

硅谷产品实战36讲 -〔曲晓音〕

Android开发高手课 -〔张绍文〕

Go语言从入门到实战 -〔蔡超〕

技术管理案例课 -〔许健〕

分布式金融架构课 -〔任杰〕

etcd实战课 -〔唐聪〕

恋爱必修课 -〔李一帆〕

操作系统实战45讲 -〔彭东〕

React Native 新架构实战课 -〔蒋宏伟〕

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