PHP is_null() 函数

PHP 教程 · 2019-01-31 18:59:50

is_null() 函数用于检测变量是否为 NULL。

PHP 版本要求: PHP 4 >= 4.0.4, PHP 5, PHP 7

语法

bool is_null ( mixed $var )

参数说明:

  • $var:要检测的变量。

返回值

如果指定变量为 NULL,则返回 TRUE,否则返回 FALSE。

实例

实例

<?php $var_name = TRUE; $var_name2 = NULL; if (is_null($var_name)) { echo '变量 var_name 为 NULL' . PHP_EOL; } else { echo '变量 var_name 不为 NULL' . PHP_EOL; } if (is_null($var_name2)) { echo '变量 var_name2 为 NULL' . PHP_EOL; } else { echo '变量 var_name2 不为 NULL' . PHP_EOL; } ?>

输出结果为:

变量 var_name 不为 NULL
变量 var_name2 为 NULL

点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Elements of Information Theory

Elements of Information Theory

Thomas M. Cover、Joy A. Thomas / Wiley-Blackwell / 2006-7 / GBP 76.50

The latest edition of this classic is updated with new problem sets and material The Second Edition of this fundamental textbook maintains the book's tradition of clear, thought-provoking instr......一起来看看 《Elements of Information Theory》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具