Php 字母和数字输入的Ctype函数
有没有办法检查输入是否同时包含字母和数字字符以及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\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";
}
}
?>