PHP 中的 ctype_graph()函数

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

ctype_graph() - 语法

ctype_graph ( $text );

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

Sr.No Parameter & Description
1

text(必需)

匹配字符串。

ctype_graph() - 返回值

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

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-ctype-graph.html

来源:LearnFk无涯教程网

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

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

技术教程推荐

面试现场 -〔白海飞〕

.NET Core开发实战 -〔肖伟宇〕

动态规划面试宝典 -〔卢誉声〕

容器实战高手课 -〔李程远〕

Spring编程常见错误50例 -〔傅健〕

中间件核心技术与实战 -〔丁威〕

Web 3.0入局攻略 -〔郭大治〕

超级访谈:对话玉伯 -〔玉伯〕

工程师个人发展指南 -〔李云〕

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