What is the recommended method in PHP to check the validity of an email address using if and else statements?

When checking the validity of an email address in PHP, it is recommended to use the filter_var() function with the FILTER_VALIDATE_EMAIL filter. This function will validate the email address format according to RFC 822 standards. By using if and else statements, you can then determine if the email address is valid or not.

$email = "example@example.com";

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