Email Validation

Email Validation in PHP

Validate email addresses in PHP with filter_var, regex fallback rules and safe handling for forms, imports and logs. Last updated September 14, 2026.

Validate email addresses in PHP with filter_var, regex fallback rules and safe handling for forms, imports and logs. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.

Recommended workflow

StepWhy it matters
Prefer built-ins firstPHP's email filter is a safer baseline than a copied pattern for most apps.
Add product rules after syntaxBlocked domains, disposable checks and uniqueness belong in separate steps.
Redact logsValidation failures can be counted without storing every submitted address.
Test imports separatelyBulk CSV input needs memory, encoding and duplicate handling too.

Starter snippet

$email = trim($_POST['email'] ?? '');
$isValid = filter_var($email, FILTER_VALIDATE_EMAIL) !== false;

Review checks

Common mistakes

Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.

Related Formalint references

Continue with Email Regex Php Guide, Php Runtime Guide, Csv Utf8 Encoding Guide.