Answers for "php filter_var boolean"

PHP
1

php filter_var boolean

$bool = filter_var("1", FILTER_VALIDATE_BOOLEAN); // true
$bool = filter_var("true", FILTER_VALIDATE_BOOLEAN); // true
$bool = filter_var("yes", FILTER_VALIDATE_BOOLEAN); // true
$bool = filter_var("on", FILTER_VALIDATE_BOOLEAN); // true
$bool = filter_var("anythingElse", FILTER_VALIDATE_BOOLEAN); // false
Posted by: Guest on February-19-2021

Browse Popular Code Answers by Language