THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP filter_has_var() Function

PHP Filter Reference PHP Filter Reference

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");
}
?>
Run example »

Definition and Usage

The filter_has_var() function checks if a variable of a specified input type exist.


Syntax

filter_has_var(type, variable)
Parameter Description
type Required. The input type to check for. Can be one of the following:
  • INPUT_GET
  • INPUT_POST
  • INPUT_COOKIE
  • INPUT_SERVER
  • INPUT_ENV
variable Required. The variable name to check

Technical Details

Return Value: Returns TRUE on success or FALSE on failure
PHP Version: 5.2.0+

PHP Filter Reference Complete PHP Filter Reference