Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 字母和数字输入的Ctype函数_Php_Ctype - Fatal编程技术网

Php 字母和数字输入的Ctype函数

Php 字母和数字输入的Ctype函数,php,ctype,Php,Ctype,有没有办法检查输入是否同时包含字母和数字字符以及Ctype?有 您是否尝试了ctype\u alnum功能? <?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";

有没有办法检查输入是否同时包含字母和数字字符以及Ctype?


您是否尝试了
ctype\u alnum
功能?
<?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";
    }
}
?>