PHP FILTER_VALIDATE_INT Filter
Complete PHP Filter Reference Manual
Definition and Usage
The FILTER_VALIDATE_INT filter validates a 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 values
- FILTER_FLAG_ALLOW_HEX - Allows hexadecimal values
Tips and Notes
**Note:** When specifying options in an array, the options must be stored in an associative multidimensional array named "options". See the example below.
Example
array("min_range"=>0, "max_range"=>256)); var_dump(filter_var($var, FILTER_VALIDATE_INT, $int_options)); ?>The output of the code is shown below:
bool(false)
Complete PHP Filter Reference Manual