ctype_alpha
ctype_alpha
Check for alphabetic character(s)
bool **ctype_alpha** mixed $text
Checks if all of the characters in the provided ,
, are alphabetic.
In the standard locale letters are just
and is
equivalent to
if $text is just a single character, but other languages have letters that
are considered neither upper nor lower case.
string``text``C``[A-Za-z]``ctype_alpha``(ctype_upper($text) || ctype_lower($text))
textThe tested string.
note.ctype.parameter.integer
note.ctype.parameter.non-string
Returns true if every character in is
a letter from the current locale, false otherwise.
ctype.result.empty-string
text
Voorbeeld: A example (using the default locale)
<?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.
ctype_upper``ctype_lower``setlocale``IntlChar::isalpha