$email = "example@email.com"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "Valid email address"; } else { echo "Invalid email address"; }
$email = "example@email.com"; if (preg_match("/^([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4})$/", $email)) { echo "Valid email address"; } else { echo "Invalid email address"; }There are also various PHP packages and libraries available for email validation, such as PHPMailer and SwiftMailer. These packages provide additional features and functionality for validating and sending emails in PHP.