FILTER_VALIDATE_INT
By using filter id of FILTER_VALIDATE_INT the same script can be written as
Now let us add one more option where we will assign minimum and maximum acceptable value of the integer. The option is added by using an array
In the above code we have used Minimum value and Maximum value for validating the integer variable. We can also specify only maximum or only minimum value by changing like this. ( One line only )
You can also read is_numeric.php to check data
FILTER_SANITIZE_NUMBER_INTId of this function is 519. By using FILTER_SANITIZE_NUMBER_INT we can remove all chars except digits and + - signs. Here is an example
Output of this is here
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
![]() |
filter_list:PHP list of filters available and how to display
filter_has_var: checking the existance of variable in PHP filter_var: Validating variable using filter id FILTER_VALIDATE_FLOAT: Validating Float data FILTER_VALIDATE_INT: Validating Integer with Maximum and Minimum range FILTER_VALIDATE_REGEXP: Validating REgular Expression FILTER_VALIDATE_EMAIL: Validating Email FILTER_VALIDATE_URL: Validating URL with query string and path FILTER_VALIDATE_IP: Validating IPV4 and IPV6 address FILTER_VALIDATE_BOOLEAN: Validating boolean variable FILTER_SANITIZE_STRING: Sanitize string FILTER_SANITIZE_URL: Sanitize url |