Web Development

I have seen things like this a hundred times:

These are just plain wrong when you’re working with PHP versions higher than 5.2.

The Filter extension is there for a reason. Email validation should be done like this:


$string_to_test = "a_bogus@email";

function is_email($email){ 
    return filter_var($email, FILTER_VALIDATE_EMAIL);

if (is_email($string_to_test)) {
  echo 'This is a valid email';
} else {
  echo 'This is not a valid email';


"This is a not valid email"