PHP 5.2 adds the filter_var function. It is an important function that assists with validating the user input.
<?php
$email_address_dirty = "haim.michael@gmail.com";
if(filter_var($email_address_dirty,FILTER_VALIDATE_EMAIL))
{
    $email_address_clean = $email_address_dirty;
}
echo $email_address_clean;
?>
The following video clip shows the execution of this code sample and explains it.
 
				






