Sometimes, while filling forms on your website, a user can mistype his email address. Using the below function you can check if the email provided by user is in correct format.
function is_validemail($email)
{
$check = 0;
if(filter_var($email,FILTER_VALIDATE_EMAIL))
{
$check = 1;
}
return $check;
}
Syntex:
<?php
$email = “blog@w2class.com”;
$check = is_validemail($email);
echo $check;
// If the output is 1, then email is valid.
?>