Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
 
PREVIOUS NEXT
Tagged: #php #boolean
ADD COMMENT
Topic
Name
8+1 =