Boolean Experiments

Back to peterdownie.com
Back to Library
Back to PHP Experiment

This is to test what equals and is identical to boolean statements. Some of this data was converted to see the effects of a conversion.

X = 0

X is of type: integer


Equals 0
Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X is of type: boolean


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Identical to FALSE
Not Equal to 2
Not Identical to 2

X = FALSE

X is of type: boolean


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Identical to FALSE
Not Equal to 2
Not Identical to 2

X is of type: integer


Equals 0
Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = 1

X is of type: integer


Not Equal to 0
Not Identical to 0
Equals 1
Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X is of type: boolean


Not Equal to 0
Not Identical to 0
Equals 1
Not Identical to 1
Equals TRUE
Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Equals 2
Not Identical to 2

X = TRUE

X is of type: boolean


Not Equal to 0
Not Identical to 0
Equals 1
Not Identical to 1
Equals TRUE
Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Equals 2
Not Identical to 2

X is of type: integer


Not Equal to 0
Not Identical to 0
Equals 1
Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = array()

X is of type: array


Not Equal to 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = array('key'=>'value')

X is of type: array


Not Equal to 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = 0.0

X is of type: double


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = "0"

X is of type: string


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = ""

X is of type: string


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = "abc"

X is of type: string


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = "0abc"

X is of type: string


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = "1abc"

X is of type: string


Not Equal to 0
Not Identical to 0
Equals 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = "2abc"

X is of type: string


Not Equal to 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Equals 2
Not Identical to 2

X = "abc2"

X is of type: string


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = null

X is of type: NULL


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

unset($x)

X is of type: NULL


Equals 0
Not Identical to 0
Not Equal to 1
Not Identical to 1
Not Equal to TRUE
Not Identical to TRUE
Equals FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = new emptyClass()

X is of type: object


Not Equal to 0
Not Identical to 0
Equals 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2

X = new notEmpty()

X is of type: object


Not Equal to 0
Not Identical to 0
Equals 1
Not Identical to 1
Equals TRUE
Not Identical to TRUE
Not Equal to FALSE
Not Identical to FALSE
Not Equal to 2
Not Identical to 2