- 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_has_var() function in PHP
The filter_has_var() function is used to check that variable of specified type exists or not.
Syntax
filter_has_var(type, var)
Parameters
type − There are five types of inputs to check i.e. INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, or INPUT_ENV.
var − The name of variable.
Return
The filter_has_var() function returns true on success and false on failure.
Example
The following is an example that is a quick check for the input variable "email”. The value INPUT_GET is used for this.
<?php if (!filter_has_var(INPUT_GET, "email")) { echo("Email isn't there!"); } else { echo("Email is there!"); } ?>
Output
The following is the output.
Email isn't there!
Advertisements