Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
