PHP filter_has_var() Function
Example
Check if the input variable "email" is sent to the PHP page, through the "get" method:
<?php
if (!filter_has_var(INPUT_GET, "email")) {
echo("Email not found");
} else {
echo("Email found");
}
?>
Try it Yourself »
Definition and Usage
The filter_has_var() function checks whether a variable of a specified input type exist.
This function checks the content received by the PHP page, so the variable must be sent to the page via e.g a querystring.
Syntax
filter_has_var(type, variable)
Parameter Values
Parameter | Description |
---|---|
type | Required. The input type to check for. Can be one of the following:
|
variable | Required. The variable name to check |
Technical Details
Return Value: | TRUE on success, FALSE on failure |
---|---|
PHP Version: | 5.2+ |
❮ Complete PHP Filter Reference