Função PHP is_null()
❮ Referência de Manipulação de Variáveis PHP
Exemplo
Verifique se uma variável é NULL ou não:
<?php
$a = 0;
echo "a is " . is_null($a) . "<br>";
$b = null;
echo "b
is " . is_null($b) . "<br>";
$c = "null";
echo "c is " . is_null($c)
. "<br>";
$d = NULL;
echo "d is " . is_null($d) . "<br>";
?>
Definição e uso
A função is_null() verifica se uma variável é NULL ou não.
Esta função retorna true (1) se a variável for NULL, caso contrário, retorna false/nada.
Sintaxe
is_null(variable);
Valores de parâmetro
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
Detalhes técnicos
Valor de retorno: | TRUE se a variável for NULL, FALSE caso contrário |
---|---|
Tipo de retorno: | boleano |
Versão do PHP: | 4.0.4+ |
❮ Referência de Manipulação de Variáveis PHP