What are common pitfalls when validating email addresses in PHP, and how can they be avoided?

Common pitfalls when validating email addresses in PHP include not using the correct validation method, not handling edge cases like special characters or multiple email addresses properly, and not utilizing built-in PHP functions for validation. To avoid these pitfalls, it is recommended to use the filter_var() function with the FILTER_VALIDATE_EMAIL flag for email validation.

$email = "example@example.com";

if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    echo "Valid email address";
} else {
    echo "Invalid email address";
}