Validation d'une adresse email en PHP (filter_var)

Function FILTER EMAIL

Email: someone@domain .local => E-mail is not valid
Email: someone@domain.ght => E-mail is valid


PHP
1
2
3
4
5
6
7
8
9
<?php
function filter_email($email) {
    if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return "E-mail is not valid";
    } else {
        return "E-mail is valid";
    }    
}
?>


TAGs : Email Validation Filter_var PHP 5.2 7

© Standalone INFORMATUX