The 'is_email' function in PHP is used to validate whether an email address is valid or not. It checks for standard syntax and basic domain validation. The function returns true if the email is valid and false if it is not.
Example #1 - Valid email address:
$email = "someemail@example.com"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "The email address is valid"; } else { echo "The email address is not valid"; }
Output: The email address is valid
Example #2 - Invalid email address:
$email = "example.com"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "The email address is valid"; } else { echo "The email address is not valid"; }
Output: The email address is not valid
The 'is_email' function can be found in various PHP libraries and packages such as:
These packages provide a comprehensive range of validation functions apart from email validation.
PHP Validator::is_email - 30 examples found. These are the top rated real world PHP examples of Validator::is_email extracted from open source projects. You can rate examples to help us improve the quality of examples.