PHP check a string is an email address format

With PHP v5.2.0 or greater, you may use regular expressions.

<?php
    if(filter_var("some@address.com", FILTER_VALIDATE_EMAIL)) {
        // valid address, do something
    }
    else {
        // invalid address, do something
    }
?>

By Keenlio, July 29, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


four × = 36

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>