PHP 检测是否全为数字或者字母方法ctype_alnum(String text)
来源:互联网 发布:golang ide 编辑:程序博客网 时间:2024/06/05 10:19
<?php
$strings = array('AbCd1zyZ9', 'foo!#$bar');
foreach ($strings as $testcase) {
if (ctype_alnum($testcase)) {
echo "The string $testcase consists of all letters or digits.\n";
} else {
echo "The string $testcase does not consist of all letters or digits.\n";
}
}
$strings = array('AbCd1zyZ9', 'foo!#$bar');
foreach ($strings as $testcase) {
if (ctype_alnum($testcase)) {
echo "The string $testcase consists of all letters or digits.\n";
} else {
echo "The string $testcase does not consist of all letters or digits.\n";
}
}
?>
对于AbCd1zyZ9字符串,由于全是数字或者字符,所以满足条件
The string AbCd1zyZ9 consists of all letters or digits.
对于foo!#$bar字符串,不满足条件。The string foo!#$bar does not consist of all letters or digits.
0 0
- PHP 检测是否全为数字或者字母方法ctype_alnum(String text)
- C# Text输入检测是否为数字
- Java中判断是否为字母或者数字
- 判断是string 是否为数字 是否为字母 是否为汉字
- java 检测string是否全是数字的思路
- PHP is_numeric 检测变量是否为数字或数字字符串
- PHP is_numeric 检测变量是否为数字或数字字符串
- PHP is_numeric 检测变量是否为数字或数字字符串
- 检测手机号码是否全为0-9的数字
- 检测是否是全数字
- String 截字符串,分割字母或者数字
- 用javascript检测输入的只能是汉字,字母或者数字,并且长度为4
- 如何判断字符为数字或者字母
- if判断变量为字母或者数字
- Asp检测字符串是否为纯字母和数字组合函数
- javascript检测是否为数字
- JavaScript判断是否为数字,字母,英文
- 字符c是否为字母或数字
- LinuxC编程实战之文件操作
- 自己实现 SharedPtr(4)—— 一个代码洁癖的救赎
- C语言getpriority()函数:取得程序进程执行优先权
- 拼图游戏学习
- jsp中Post和Get请求获取表单里的中文
- PHP 检测是否全为数字或者字母方法ctype_alnum(String text)
- linux管理和进程(4)
- 2016 Multi-University Training Contest 1-1001---HDU 5723 Abandoned country(DFS+最小生成树)
- link
- ART探险(1) - oatdump看到的世界
- Team Foundation Server 2015 Update 3 RC 发布啦
- c 函数
- DDD领域驱动设计(Domain Driven Design)(转)
- 创业公司产品经理才是王道——一将无能,累死三军