Question: how to check if string contains only letters php?
Answer: Use preg_match(). You can use preg_match() function for example. if (preg_match('/[^A-Za-z0-9]+/', $str)) { // ok... } How to Check if given String contains only Alphanumeric Characters , the specific character (Unicode ch) is either a letter or a digit.