How to use FILTER VALIDATE EMAIL in PHP

This article describe about FILTER_VALIDATE_EMAIL Filter in PHP.
  • 1986

FILTER_VALIDATE_EMAIL Filter

For validate value as a e-mail address use FILTER_VALIDATE_EMAIL Filter.

  • Name: "validate-email"
  • ID-Number: 274

Example

<html>
<body>
<?php
$email = "someone@pro gram.com";

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
echo "E-mail is not valid";
}
else
{
echo "E-mail is valid";
}
?>
</body>
</html>

 

Output


filtervalidateemailphp.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.