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.

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

技术教程推荐

AI技术内参 -〔洪亮劼〕

深入拆解Java虚拟机 -〔郑雨迪〕

程序员进阶攻略 -〔胡峰〕

程序员的数学基础课 -〔黄申〕

Vue开发实战 -〔唐金州〕

零基础学Java -〔臧萌〕

OAuth 2.0实战课 -〔王新栋〕

Selenium自动化测试实战 -〔郭宏志〕

手把手带你写一个MiniSpring -〔郭屹〕

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