PHP Tutorial Tutorials - PHP Booleans

Booleans

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
Date:2019-09-30 18:20:42 From:www.Lautturi.com author:Lautturi