ctype_alpha(): Validating only alphabetic characters
$var="abcdef"; // This is alphabetic
//$var="abc=123"; // This is NOT alphabetic
//$var="123"; // This is NOT alphabetic
//$var='xyz12'; // This is NOT alphabetic
//$var='123.56'; // This is NOT alphabetic
//$var=123; // This is NOT alphabetic
if(ctype_alpha($var)){
echo " This is alphabetic ";
}else{
echo " This is NOT alphabetic ";
}
Syntax
bool ctype_alpha(string $input_string)
Returns True or False
By changing the value of $var you can check this function.
By using ctype_alpha function in php we can check or validate alphabetic characters only. Using this function we can check any input coming from insecure ( or any other ) sources. This function is case insensitive so can't differentiate between lower case and upper case alphabetic characters.