PHP FILTER_VALIDATE_BOOLEAN Filter
Definition and Usage
The FILTER_VALIDATE_BOOLEAN filter validates values as boolean options.
- Name: "boolean"
- ID-number: 258
Possible return values:
- If it is "1", "true", "on" and "yes", it returns true.
- If it is "0", "false", "off", "no" and "", it returns false.
- Otherwise return NULL.
Example
<?php
var_dump(filter_var($var, FILTER_VALIDATE_BOOLEAN
));
?>
Output:
bool(true)