This is the simplest type. A boolean expresses a truth value.PHP provides a couple of constants especially for use as Booleans: TRUE and FALSE.
if($x) | |
$x = 5 | true |
$x = 1 | true |
$x = 0 | false |
$x = -1 | true |
$x = "8" | true |
$x = "1" | true |
$x = "0" | false |
$x = "-1" | true |
$x = "foobar" | true |
$x = "true" | true |
$x = "false" | true |
$x = "" | false |
$x = null | false |
var $x;(not set) | false |
$x = array() | false |
$x = array(1,2); | true |
$x = false | false |