valid_email()

valid_email($email)

Parameters:
  • $email (string) – E-mail address
Returns:

TRUE if a valid email is supplied, FALSE otherwise

Return type:

bool

Checks if the input is a correctly formatted e-mail address. Note that is doesn’t actually prove that the address will be able recieve mail, but simply that it is a validly formed address.

Example:

if (valid_email('[email protected]'))
{
        echo 'email is valid';
}
else
{
        echo 'email is not valid';
}

Note

All that this function does is to use PHP’s native filter_var():

(bool) filter_var($email, FILTER_VALIDATE_EMAIL);
doc_CodeIgniter
2016-10-15 16:32:46
Comments
Leave a Comment

Please login to continue.