Return to Snippet

Revision: 31143
at August 30, 2010 23:20 by sandrews_06


Initial Code
<?php
//Bad Email...
$badEmail = "bad@email";

//Run the email through an email validation filter.
if( !filter_var($badEmail, FILTER_VALIDATE_EMAIL) ){
  echo "Email is no good.";
}else{
  echo "Nice email.";
}

//Result - Email is no good.
?>

Initial URL
http://www.devirtuoso.com/2010/08/quick-tip-validate-email-addresses-with-php/

Initial Description

                                

Initial Title
Check Valid Email using filter_var

Initial Tags
email, php, validation

Initial Language
PHP