is_email gives me error

I was just missing the “not” operator (!) in my conditional (if(is_email($email))), which in turn resulted in valid email addresses being treated as invalid. So I added the ! and that solved the problem:

// code before; incorrect - missing the !
if(is_email($email)) {
    $error['email_valid'] = "Email has no valid value";
}

// code after; working as expected after I added the !
if(! is_email($email)) { // if email is invalid, add the error message
    $error['email_valid'] = "Email has no valid value";
}