PHP 中的 ctype_print()函数

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

ctype_print() - 语法

ctype_print ( $text );

此函数检查提供的字符串text中的所有字符是否均可打印。

Sr.No Parameter & Description
1

text(必需)

匹配字符串。

ctype_print() - 返回值

如果文本中的每个字符都将实际创建输出(包括空格),则返回true。如果文本包含控制字符或根本不具有任何输出或控制功能的字符,则返回False。

ctype_print() - 示例

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

这将产生以下输出-

asdf\n\r\t consists of all printable characters.
k211 consists of all printable characters.
fooo#int%@consists of all printable characters.

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

技术教程推荐

机器学习40讲 -〔王天一〕

TensorFlow快速入门与实战 -〔彭靖田〕

图解 Google V8 -〔李兵〕

深度学习推荐系统实战 -〔王喆〕

说透数字化转型 -〔付晓岩〕

eBPF核心技术与实战 -〔倪朋飞〕

结构学习力 -〔李忠秋〕

AI大模型企业应用实战 -〔蔡超〕

互联网人的数字化企业生存指南 -〔沈欣〕

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