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;
?>
Run example »
Definition and Usage
The FILTER_SANITIZE_EMAIL filter removes all illegal characters from an email address.
< PHP Filter Reference