PHP FILTER_SANITIZE_EMAIL Filter

❮ PHP Filter Reference

Example

Remove all illegal characters from an email address:

<?php
$email = "john(.doe)@exa//mple.com";

$email = filter_var($email, FILTER_SANITIZE_EMAIL);
echo $email;
?>
Try it Yourself »

Definition and Usage

The FILTER_SANITIZE_EMAIL filter removes all illegal characters from an email address.


❮ PHP Filter Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.