(PHP 4 >= 4.0.4, PHP 5)
ctype_alpha -- 检查字母
bool ctype_alpha ( string text )
检查字母
<?php
$strings = array('KjgWZC', 'arf12');
foreach ($strings as $testcase) {
if (ctype_alpha($testcase)) {
echo "The string $testcase consists of all letters.\";
} else {
echo "The string $testcase does not consist of all letters.\";
}
}
?>
The string KjgWZC consists of all letters. The string arf12 does not consists of all letters.