FILTER_SANITIZE_EMAIL constant in PHP



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.

[email protected]
Updated on: 2020-06-27T08:40:01+05:30

426 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements