FILTER_SANITIZE_EMAIL constant in PHP

PHPProgrammingServer Side Programming

The FILTER_SANITIZE_EMAIL constant deletes all illegal characters from an email address.

Return

The FILTER_SANITIZE_EMAIL constant does not return anything.

Example

<?php
   $myemail = "abc@demo//.com";
   $myemail = filter_var($myemail, FILTER_SANITIZE_EMAIL);
   echo $myemail;
?>

Output

The following is the output.

abc@demo.com
raja
Updated on 27-Jun-2020 08:40:01

Advertisements