= 4.0.4, PHP 5, PHP 7 Parameter Description: $var: The value to be checked />
English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
is_null() The function is used to check if a variable is NULL.
PHP version requirement: PHP 4 >= 4.0.4, PHP 5, PHP 7
bool is_null ( mixed $var )
Parameter description:
If the specified variable is NULL, it returns TRUE, otherwise it returns FALSE.
<?php $var_name = TRUE; $var_name2 is NULL; if (is_null($var_name)) { echo 'variable var_name is NULL' . PHP_EOL; } else { echo 'variable var_name is not NULL' . PHP_EOL; } if (is_null($var_name2)) { echo 'variable var_name2 is NULL' . PHP_EOL; } else { echo 'variable var_name2 is not NULL' . PHP_EOL; } ?>
The output is:
variable var_name is not NULL variable var_name2 is NULL