Sometimes, when filling out a form on a website, the user may enter an incorrect email address. This function can verify whether the email address is valid.
function is_validemail($email)
{
$check = 0;
if(filter_var($email,FILTER_VALIDATE_EMAIL))
{
$check = 1;
}
return $check;
}
Copy code
Usage:
$email = "blog@open.com";
$check = is_validemail($email);
echo $check;
// If the output is 1, then email is valid.
?>
Copy code
Email address, PHP
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn