Sample php function to check the email address whether it is valid or not.

Code Snippet

<?php

function is_valid_email($email)  
{      
	if(!filter_var($email, FILTER_VALIDATE_EMAIL))      
	{          
		return false;      
	}      
	else      
	{          
		return true;      
	}  
}

?>

Sample Usage

<?php  

$email = '[email protected]';
$is_valid_email = is_valid_email($email);
if($is_valid_email) 
{  
  //sent_mail(email) ;  
}  

?>


author's photo

Author : Blue Cloud

Just a normal software developer who love to write code. Developing professional software since 1999. After working in the software industry for many years, I've started my own website to share knowledges and experiences.

COMMENTS
blog comments powered by Disqus