PHP 中的 ctype_alpha()函数

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

ctype_alpha() - 语法

ctype_alpha ( $text );

它检查提供的字符串text中的所有字符是否都是字母。

Sr.No Parameter & Description
1

text(必需)

匹配字符串。

无涯教程网

ctype_alpha() - 返回值

如果文本中的每个字符都是字母,则返回TRUE,否则返回FALSE。

ctype_alpha() - 示例

<?php
   $strings=array('example', 'example1234');
   
   foreach ($strings as $test) {
      if (ctype_alpha($test)) {
         echo "$test consists of all letters.\n";
      }else {
         echo "$test does not have all letters.\n";
      }
   }
?> 

这将产生以下输出-

example consists of all letters.
example1234 does not have all letters.

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

技术教程推荐

人工智能基础课 -〔王天一〕

快速上手Kotlin开发 -〔张涛〕

玩转Git三剑客 -〔苏玲〕

OpenResty从入门到实战 -〔温铭〕

消息队列高手课 -〔李玥〕

ZooKeeper实战与源码剖析 -〔么敬国〕

Java业务开发常见错误100例 -〔朱晔〕

零基础入门Spark -〔吴磊〕

现代C++20实战高手课 -〔卢誉声〕

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