0% found this document useful (0 votes)
713 views1 page

PHP Practical No.12

This PHP code checks if an email address is valid by using the filter_var() function to validate the email against the FILTER_VALIDATE_EMAIL filter. It passes a sample email address and if it is valid, it echoes a message saying so, and if invalid, it echoes a message saying the email is invalid.

Uploaded by

Abhishek Jaikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
713 views1 page

PHP Practical No.12

This PHP code checks if an email address is valid by using the filter_var() function to validate the email against the FILTER_VALIDATE_EMAIL filter. It passes a sample email address and if it is valid, it echoes a message saying so, and if invalid, it echoes a message saying the email is invalid.

Uploaded by

Abhishek Jaikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Code:

1. PHP program to check that e-mail is valid


<?php
// Passing valid/invalid email
$email = "[email protected]";
if (filter_var($email, FILTER_VALIDATE_EMAIL))
{

echo '"' . $email . '" is valid Email ID'."\n";


}
else
{
echo '"' . $email . '" is invalid Email ID'."\n";
}
?>

Output-

You might also like