PHP is_null()函数

本文概述

通过使用is_null函数, 我们可以检查变量是否为NULL。此功能在PHP 4.0.4中引入。

SYNATX

bool is_null ( mixed $var )

参数

Parameter Description 是强制性的
var 正在评估的变量。 compulsory

返回类型

如果var为null, 则PHP的is_null()函数返回true, 否则返回false。

重要的提示:

我们可以使用unset函数来取消设置变量值。

例子1

<?php
	$var1 = TRUE;
	if (is_null($var1))
		{
			echo 'Variable is  NULL';
		}
		else
		{
			echo 'Variable is not NULL';
		}
?>
PHP is_null()函数

例子2

<?php
	$x= 100;
	unset($x);
	echo is_null($x);
?>
PHP is_null()函数

例子3

<?php  
	$x = NULL; 
	$y = "\0";
	is_null($x) ? print_r("True\n") : print_r("False\n");
	echo "<br/>";
	is_null($y) ? print_r("True\n") : print_r("False\n");
?>
PHP is_null()函数

来源:

https://www.srcmini02.com/29232.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37994.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?