PHP5 Email Validation

In prior version of PHP you had to use some regex solution to validate an email address, now in PHP5 it’s as simple as:

I’ve been using PHP5 ever since it was released but didn’t look into the PECL Filter extension until recently. Pretty handy.

Please note that I also added the FILTER_SANITIZE_EMAIL filter which removes all illegal e-mail characters from a string. This is not needed if you only want to validate and not clean the input. 🙂

,