- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
filter_var() function in PHP
The filter_var() function is used to filter a variable with a specified filter.
Syntax
filter_var(variable, filter, options)
Parameters
variable − The name of variable.
filter − The name of filter to get ID.
options − Specifies options to use.
Return
The filter_var() function returns filtered data on success, or false on failure.
Example
<?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
Advertisements