Tablas de comparación de tipos de datos en PHP

Comparaciones de $x con funciones PHP


Expresión
gettype()
empty()
is_null()
isset()
boolean : if($x)




$x = "";
string
TRUE
FALSE
TRUE
FALSE


$x = null
NULL
TRUE
TRUE
FALSE
FALSE


var $x;
NULL
TRUE
TRUE
FALSE
FALSE


$x no definido
NULL
TRUE
TRUE
FALSE
FALSE


$x = array();
array
TRUE
FALSE
TRUE
FALSE


$x = false;
boolean
TRUE
FALSE
TRUE
FALSE


$x = true;
boolean
FALSE
FALSE
TRUE
TRUE


$x = 1;
integer
FALSE
FALSE
TRUE
TRUE


$x = 42;
integer
FALSE
FALSE
TRUE
TRUE


$x =…

Leer artículo completo →