How to check whether an email is valid or not in php ?

  • 0

Using filter_var function , we can check whether an email is valid or not valid with FILTER_VALIDATE_EMAIL filter.

if(filter_var(“sample@gmail.com”,FILTER_VALIDATE_EMAIL))
{

echo “valid”;

} else echo “not valid”;

Using filter_var function , we can check whether an email is valid or not valid with FILTER_VALIDATE_EMAIL filter. if(filter_var(“sample@gmail.com”,FILTER_VALIDATE_EMAIL)) { echo “valid”; } else echo “not valid”;

Using filter_var function , we can check whether an email is valid or not valid with FILTER_VALIDATE_EMAIL filter. if(filter_var(“sample@gmail.com”,FILTER_VALIDATE_EMAIL)) { echo “valid”; } else echo “not valid”;