Tag: sanitize email php

  • Validating An Email Address in PHP 5

    In PHP 5.2 Zend has added a function called filter_var(). It validates a lot of things for you without having to write any regular expressions or anything else. You do it like this: if (filter_var($emailAddress, FILTER_VALIDATE_EMAIL) !== false) { print ‘valid email’; } else { print ‘Invalid email’; } filter_var()returns the value back if its…