FILTER_VALIDATE_BOOLEAN
Here is a list of outputs we will get for different data stored in variable.
For different value of Boolean variable we will get this output. You can see we get bool(false) for non Boolean value. Now we will add one option FILTER_NULL_ON_FAILURE to get null value for all non Boolean variables. Here is the code
The output for different value of the variable is listed here for easy understanding.
As you can see we are getting NULL value for all non boolean values.
![]()
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 |