php——学习笔记,空值

来源:互联网 发布:屏幕饱和度调节软件 编辑:程序博客网 时间:2024/05/30 23:31

空值不区分大小写,null和NULL效果是一样的

被赋予空值的情况有以下3种:1.没有被赋任何值

                                                 2.被赋值null

                                                 3.被unset()函数处理过

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php
 echo"变量(\$string1)直接赋值为null:";
 $string1=null;
 $string2;
 $string3="str";
 unset($string3);
 if(is_null($string1))
  echo'string1 = null';
 if(is_null($string2))
  echo'string2 = null';
 if(is_null($string3))
  echo'string3 = null';
?>
</body>
</html>

有些解析器是可以解析出3句话的,但是有些就会提示错误notice。反正结果就是3条都是空

0 0
原创粉丝点击