Validation Patterns
Email Format
Use PHP's filter helper to check an email shape.
Email Format
email_format.php
<?php
$email = ;
$checked = filter_var($email, FILTER_VALIDATE_EMAIL);
$status = $checked === false ? "invalid" : "valid";
echo "email=" . $email . "\n";
echo "status=" . $status . "\n";
<?php
$email = ;
$checked = filter_var($email, FILTER_VALIDATE_EMAIL);
$status = $checked === false ? "invalid" : "valid";
echo "email=" . $email . "\n";
echo "status=" . $status . "\n";
<?php
$email = ;
$checked = filter_var($email, FILTER_VALIDATE_EMAIL);
$status = $checked === false ? "invalid" : "valid";
echo "email=" . $email . "\n";
echo "status=" . $status . "\n";
email-format
`filter_var` can validate common scalar formats. The example converts the result into a simple label for replay.