Created
May 19, 2020 09:02
-
-
Save rwaddin/2701caeeae8b63a05265fd035d05450e to your computer and use it in GitHub Desktop.
To validate email with php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# sample 1 | |
function isValidEmail($email){ | |
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false; | |
} | |
# sample2 | |
function isValidEmail($email) { | |
return filter_var($email, FILTER_VALIDATE_EMAIL) | |
&& preg_match('/@.+\./', $email); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment