PHP FILTER_VALIDATE_INT Filter
Definition and Usage
The FILTER_VALIDATE_INT filter validates the value as an integer.
- Name: "int"
- ID-number: 257
Possible options or flags:
- min_range - Specifies the minimum integer value
- max_range - Specifies the maximum integer value
- FILTER_FLAG_ALLOW_OCTAL - Allows octal numbers
- FILTER_FLAG_ALLOW_HEX - Allows hexadecimal numbers
Tips and Comments
Note:When specifying options in an array, the options must be stored in an associative multidimensional array named "options". See the following example.
Example
<?php
$var=300;
$int_options = array("options"=>
var_dump(filter_var($var, FILTER_VALIDATE_INT
, $int_options));
?>
Output:
bool(false)