(PHP 4 >= 4.0.4, PHP 5, PHP 7)
ctype_alpha — 锟斤拷锟斤拷锟街凤拷锟斤拷锟�
$text
) : bool
锟介看锟结供锟斤拷string锟斤拷text
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷欠锟街伙拷锟斤拷锟斤拷址锟斤拷锟�
锟节憋拷准锟斤拷 C 锟斤拷锟皆伙拷锟斤拷锟铰o拷锟斤拷母锟斤拷锟斤拷锟斤拷指
[A-Za-z] 锟斤拷 ctype_alpha() 锟斤拷同锟斤拷
(ctype_upper($text) || ctype_lower($text))
锟斤拷锟� text
锟角简单的碉拷锟斤拷锟街凤拷锟斤拷锟斤拷锟矫o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷些锟斤拷母锟斤拷锟斤拷为锟饺诧拷锟角达拷写也锟斤拷锟斤拷小写锟斤拷
text
锟斤拷锟斤拷锟皆碉拷锟街凤拷锟斤拷锟斤拷
锟斤拷锟斤拷诘锟角帮拷锟斤拷曰锟斤拷锟斤拷锟� text
锟斤拷锟矫匡拷锟斤拷址锟斤拷锟斤拷锟揭伙拷锟斤拷锟侥革拷锟斤拷锟矫达拷头锟斤拷锟�TRUE
锟斤拷锟斤拷之锟津返伙拷FALSE
锟斤拷
Example #1 一锟斤拷 ctype_alpha() 锟斤拷锟接o拷使锟斤拷默锟较碉拷锟斤拷锟皆伙拷锟斤拷锟斤拷
<?php
$strings = array('KjgWZC', 'arf12');
foreach ($strings as $testcase) {
if (ctype_alpha($testcase)) {
echo "The string $testcase consists of all letters.\n";
} else {
echo "The string $testcase does not consist of all letters.\n";
}
}
?>
锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�
The string KjgWZC consists of all letters. The string arf12 does not consist of all letters.
Note:
锟斤拷锟斤拷锟斤拷锟揭伙拷锟� -128 锟斤拷 255 之锟斤拷(锟斤拷)锟斤拷锟斤拷锟斤拷, 锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷ASCII锟街凤拷 (锟斤拷值锟斤拷锟斤拷锟斤拷 256 锟斤拷支锟斤拷锟斤拷展ASCII锟街凤拷). 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷十锟斤拷锟斤拷锟街凤拷锟斤拷.