Skip to content

Instantly share code, notes, and snippets.

@rwaddin
Created May 19, 2020 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwaddin/2701caeeae8b63a05265fd035d05450e to your computer and use it in GitHub Desktop.
Save rwaddin/2701caeeae8b63a05265fd035d05450e to your computer and use it in GitHub Desktop.
To validate email with php
<?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