How to check if the string has alphabets in PHP
The ctype_alpha and ctype_digit doesn't help in it. is their any method?
You can use preg_match
for this.
if(preg_match("/[a-z]/i", $string)){
print "it has alphabet!";
}
If you want to check for all the characters to be alphabet, then use anchor around the regex. For example ^[a-z]+$
.