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.

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

技术教程推荐

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

技术领导力实战笔记 -〔TGO鲲鹏会〕

大规模数据处理实战 -〔蔡元楠〕

苏杰的产品创新课 -〔苏杰〕

To B市场品牌实战课 -〔曹林〕

物联网开发实战 -〔郭朝斌〕

说透低代码 -〔陈旭〕

手把手教你落地DDD -〔钟敬〕

结构思考力 · 透过结构看思考 -〔李忠秋〕

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