|
|
1
10
变量刚刚设置好——在这一行之前,我们声明了名为“data”的新变量,即。
变量中填充了数据。它不能有空数组,因为
变量不是空字符串。但也不能为空值(上面的示例)。
变量用任何数据填充。一模一样
|
|
|
2
22
http://www.php.net/manual/en/types.comparisons.php Expression gettype() empty() is_null() isset() if($x) $x = ""; string TRUE FALSE TRUE FALSE $x = null; NULL TRUE TRUE FALSE FALSE var $x; NULL TRUE TRUE FALSE FALSE $x undefined NULL TRUE TRUE FALSE FALSE $x = array(); array TRUE FALSE TRUE FALSE $x = false; boolean TRUE FALSE TRUE FALSE $x = true; boolean FALSE FALSE TRUE TRUE $x = 1; integer FALSE FALSE TRUE TRUE $x = 42; integer FALSE FALSE TRUE TRUE $x = 0; integer TRUE FALSE TRUE FALSE $x = -1; integer FALSE FALSE TRUE TRUE $x = "1"; string FALSE FALSE TRUE TRUE $x = "0"; string TRUE FALSE TRUE FALSE $x = "-1"; string FALSE FALSE TRUE TRUE $x = "php"; string FALSE FALSE TRUE TRUE $x = "true"; string FALSE FALSE TRUE TRUE $x = "false"; string FALSE FALSE TRUE TRUE
如你所见,
|
|
3
4
|
|
|
4
0
if(isset($data))-确定是否设置了变量(未下注)
如果($data!=''){这是一种字符串类型,用于检查$data是否不等于空字符串 if($data){这是一个查找真或假的过程(aka:0或1) |