What are common pitfalls when validating input fields in PHP, specifically when restricting to alphabetic characters?

Common pitfalls when validating input fields in PHP for alphabetic characters include not accounting for special characters or spaces, not properly handling multibyte characters, and not considering case sensitivity. To address these issues, it is important to use regular expressions to ensure that only alphabetic characters are allowed, including handling multibyte characters and case sensitivity.

// Validate input field for alphabetic characters
$input = "JohnDoe";

if (preg_match('/^[a-zA-Z]+$/u', $input)) {
    echo "Input contains only alphabetic characters.";
} else {
    echo "Input contains non-alphabetic characters.";
}