Syntax

boolean isemail(string $email)

(PHP 4, PHP 5)

$email Email to test if it is vaid or not
RETURNS True result if the argument contains a valid e-mail address, false otherwise.

What it Does

Tests an expression to see if it contains a valid e-mail address or not. This function uses an advanced regular expression (POSIX version) to check the string argument.

Function Declaration

function isemail($email) {
    return preg_match('|^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{2,})+$|i', $email);
}
 
isemail.txt · Last modified: Apr 18, 2008 - 2:00pm (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki