Skip to content

Validating an alphabetic string

Validating string, alphabetics: ctype_alpha()

When you need to validate strings, you can use one of the ctype_...() functions.

The ctype_alpha() function returns true if the input string contains all alphabetic characters.

ctype_alpha("myteststring"); // true
ctype_alpha("my test string"); // false