ctype_alnum

(PHP 4 >= 4.0.4, PHP 5, PHP 7)

ctype_alnum锟斤拷锟斤拷母锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟�

说锟斤拷

ctype_alnum ( string $text ) : bool

锟斤拷锟斤拷峁╋拷锟�string,text 锟角凤拷全锟斤拷为锟斤拷母锟斤拷(锟斤拷)锟斤拷锟斤拷锟街凤拷锟斤拷

锟斤拷锟斤拷

text

锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟�text锟斤拷锟斤拷锟叫碉拷锟街凤拷全锟斤拷锟斤拷锟斤拷母锟斤拷(锟斤拷锟斤拷)锟斤拷锟街o拷锟斤拷锟斤拷 TRUE 锟斤拷锟津返伙拷FALSE

锟斤拷锟斤拷

Example #1 A ctype_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";
    }
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

The string AbCd1zyZ9 consists of all letters or digits.
The string foo!#$bar does not consist of all letters or digits.

注锟斤拷

Note:

锟斤拷锟斤拷锟斤拷锟揭伙拷锟� -128 锟斤拷 255 之锟斤拷(锟斤拷)锟斤拷锟斤拷锟斤拷, 锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷ASCII锟街凤拷 (锟斤拷值锟斤拷锟斤拷锟斤拷 256 锟斤拷支锟斤拷锟斤拷展ASCII锟街凤拷). 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷十锟斤拷锟斤拷锟街凤拷锟斤拷.

锟轿硷拷