首页 > 编程知识 正文

ctype函数PHP ctypealpha函数与示例,matlab写函数程序示例

时间:2023-05-06 10:34:31 阅读:269467 作者:1760

ctype函数

PHP ctype_alpha()函数 (PHP ctype_alpha() function)

ctype_alpha() function is a character type (CType) function in PHP, it is used to check whether a given string contains only alphabets or not.

ctype_alpha()函数是PHP中的字符类型(CType)函数,用于检查给定的字符串是否仅包含字母。

It returns true – if the string contains only alphabets, else it returns false.

它返回true -如果字符串只包含字母,否则返回FALSE。

Syntax:

句法:

ctype_alpha(string) : bool

Example:

例:

Input: "Hello" Output: true Input: "Hello123" Output: false Input: "[email protected]&a" Output: false

PHP code:

PHP代码:

<?php $str = "Hello"; if(ctype_alpha($str)) echo ("$str contains only alphabets.n"); else echo ("$str does not contain only alphabets.n"); $str = "Hello123"; if(ctype_alpha($str)) echo ("$str contains only alphabets.n"); else echo ("$str does not contain only alphabets.n"); $str = "Hello world"; if(ctype_alpha($str)) echo ("$str contains only alphabets.n"); else echo ("$str does not contain only alphabets.n"); $str = "[email protected]&a"; if(ctype_alpha($str)) echo ("$str contains only alphabets.n"); else echo ("$str does not contain only alphabets.n");?>

Output

输出量

Hello contains only alphabets.Hello123 does not contain only alphabets.Hello world does not contain only alphabets.[email protected]&a does not contain only alphabets.

翻译自: https://www.includehelp.com/php/ctype_alpha-function-with-example.aspx

ctype函数

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。