PHP FILTER_VALIDATE_INT Filter
Complete PHP Filter Reference
Definition and Usage
The FILTER_VALIDATE_INT filter validates value as integer.
- Name: "int"
- ID-number: 257
Possible options and flags:
- min_range - specifies the minimum integer value
- max_range - specifies the maximum integer value
- FILTER_FLAG_ALLOW_OCTAL - allows octal number values
- FILTER_FLAG_ALLOW_HEX - allows hexadecimal number values
Tips and Notes
Note: When specifying options in an array. The options must be in an
associative multidimensional array with the name "options". See example below
Example
<?php
$var=300;
$int_options = array("options"=>
array("min_range"=>0, "max_range"=>256));
var_dump(filter_var($var, FILTER_VALIDATE_INT, $int_options));
?>
|
The output of the code will be:
Complete PHP Filter Reference
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|