What is the potential pitfall of using the explode function to split an email address in PHP?

The potential pitfall of using the explode function to split an email address in PHP is that it may not handle all possible email address formats correctly. To ensure accurate splitting of an email address, it is recommended to use the filter_var function with the FILTER_VALIDATE_EMAIL flag to validate the email address first before splitting it.

$email = "example@example.com";

if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
    list($username, $domain) = explode('@', $email);
    echo "Username: $username, Domain: $domain";
} else {
    echo "Invalid email address";
}