X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP FILTER_VALIDATE_BOOLEAN Filter


PHP Filter Reference Complete PHP Filter Reference

Definition and Usage

The FILTER_VALIDATE_BOOLEAN filter validates value as a boolean option.

  • Name: "boolean"
  • ID-number: 258

Possible return values:

  • Returns TRUE for "1", "true", "on" and "yes"
  • Returns FALSE for "0", "false", "off" and "no"
  • Returns NULL otherwise.

Example

<?php
$var="yes";

var_dump(filter_var($var, FILTER_VALIDATE_BOOLEAN));
?>

The output of the code will be:

bool(true)


PHP Filter Reference Complete PHP Filter Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook