Validate an email address with PHP
Free Scripts :: PHP :: Validation :: Validate an email address with PHP
Author: Salman Javaid
Website: http://www.salman.be
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




