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