Home > Article > Backend Development > PHP Regular Determine Whether the Input Is a Letter Example Program_PHP Tutorial
To determine whether it is a pure letter in php, we can directly use the regular /^[a-zA-Z]$/ to verify, including uppercase and lowercase letters. Students who need to know more can refer to it.
Upload the code
The code is as follows
|
Copy code
|
||||||||
$str = "dasdadsfsadASDSADS";
| if (preg_match('/^[a-zA-Z]+$/',$str))