banner image
Sedang Dalam Perbaikan

How to Validate Email in PHP


How to Validate Email in PHP

You can validate Email in PHP by this following function and check the code snippet.The function is FILTER_VALIDATE_EMAIL which is lie in FILTER_VAR having 2 parameters first one is the email you can directly write as (!filter_var("someone@exa mple.com",FILTER_VALIDATE_EMAIL))
but you better check that yourself and then comment back.
<?php
$email = "someone@exa mple.com";

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

This will return E-mail is not Valid.
How to Validate Email in PHP How to Validate Email in PHP Reviewed by MCH on April 23, 2014 Rating: 5

No comments:

Powered by Blogger.