The FILTER_VALIDATE_EMAIL filter validates value as an e-mail address.
<?php $email = "someone@exa mple.com";
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "E-mail is not valid"; } else { echo "E-mail is valid"; } ?>
The output of the code will be:
E-mail is not valid
Jump to: Top of Page or HOME or Printer friendly page
W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2008 by Refsnes Data. All Rights Reserved.