FILTER_VALIDATE_EMAIL constant in PHP

PHPProgrammingServer Side Programming

The FILTER_VALIDATE_EMAIL() constant validates an email address.

Return

The FILTER_VALIDATE_EMAIL() does not return anything.

Example

 Live Demo

<?php
   $myEmail = "examplee@demo.com";
   if (filter_var($myEmail, FILTER_VALIDATE_EMAIL)) {
      echo("$myEmail = valid email address");
   } else {
      echo("$myEmail = invalid email address");
   }
?>

Output

The following is the output.

examplee@demo.com = valid email address
raja
Published on 04-Dec-2018 06:55:09
Advertisements