Wednesday , December 12 2018
Home / PHP / Validate Email Address

Validate Email Address

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.
?>

About admin

Check Also

Resize Images in php

Creating thumbnails of the images is required many a times, this code will be useful ...

Leave a Reply