PHP FILTER_SANITIZE_EMAIL Filter

What is FILTER_SANITIZE_EMAIL filter in PHP?

Explanation

PHP FILTER_SANITIZE_EMAIL is used to remove all unwanted special characters from an email address. This filter allows letters, digits and the following special characters $-_.+!*'(),{}|\^~[]`"><#%;/?:@&=
Name: "email"
ID-number: 517

Example :


<?php
$var="support@hscr\ipts.com";
echo filter_var($var, FILTER_SANITIZE_EMAIL);
?>

Result :

support@hscripts.com

In the above example, the unwanted special character \ is removed from the given email address.

PHP Topics


Ask Questions

Ask Question