,
Share with your friends 

Shortest way for e-mail validation

0 ratings Views 240 
Author: Susanta_de8813ff (Susanta Sahoo)  View Profile |  View other solutions by this author

Question / Problem


What is the shortest method in PHP to validate an e-mail id?

Solution

if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
     echo "Invalid e-mail";
}else{
     echo "Valid e-mail";
}

Applies to

PHP

Rank It

Login to rank it

Report


Advertisement