Let's check email is valid or not using filter_var function and pass the parameter FILTER_VALIDATE_EMAIL so this will check email is valid or not

#example.php

<?php
$email = "mail@domain.com";
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
   echo $emailErr = "Invalid email format";
} else {
    echo $email . "is valid email";
}
?>

Output:

mail@domain.com is valid mail