PHP 5.2.0 onwards has the filter_var function which can be used to validate many different inputs.
To validate an email address :
<?php
//Validate an email address in PHP 5.2.0 onwards
$email_address = “me@example.com”;
if (filter_var($email_address, FILTER_VALIDATE_EMAIL)) {
// The email address is valid
} else {
// The email address is not valid
}
?>