How to use filter var in PHP

This article describe about filter_var() Function in PHP.
  • 1417

filter_var() Function

This function filters a variable with the specified filter.

On success return filtered data and on failure FALSE.

Syntax

filter_var (variable, filter, option)

 

Example

 

<html>
<body>
<?php
if(!filter_var("someone@example....com", FILTER_VALIDATE_EMAIL))
{
echo("E-mail is not valid");
}
else
{
echo("E-mail is valid");
}
?>
</body>
</html>

Output

pic6.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.