Validate an email address with PHP

Free Scripts :: PHP :: Validation :: Validate an email address with PHP

Author: Salman Javaid

Website: http://www.salman.be

  • Validate an email address with php.
  • How to validate an email address with php.
  • Validate an email value with php.

Function accepts a parameter and returns false if value is not a valid email address.
Function
function isValidEmail($string){
if(!preg_match("/^([a-z0-9+_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,6}$/i",$string)){
return false;
}
}
Calling The Function
$string='salman@salman.be';
if(isValidEmail($string)!==false){
echo 'Value is an integer';
}else{
echo 'Value is not a valid email address';
}
Output
Value is a valid email address

Comments

No comments. Be the first one.

Leave a comment

Full Name*
Comments*
Security Code*

Our Partners

Getty Icons  Salman Creations
Free High Quality Images  Learn Free Languages 
Opal Hosting  R-Tech Solutions
  • Submit a Script

    Click here to submit your script.