解析PHP中empty is_null和isset的测试
时间:2023-11-18 17:39:06
代码如下:
<?php
$a;
$b = false;
$c = '';
$d = 0;
$e = null;
$f = array();
首先是empty的var_dump输出:
boolean true
boolean true
boolean true
boolean true
boolean true
boolean true
然后是is_null的输出:
boolean true
boolean false
boolean false
boolean false
boolean true
boolean false
最后是isset的输出:
boolean false
boolean true
boolean true
boolean true
boolean false
boolean true
由此可见 empty() 可以用来判定所有的数据类型是否为空或假,而 is_null 与 isset 基本一样,只能用来判断是否为NULL和未定义.
标签:PHP,empty,is,null,isset
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
MySQL内部临时表的具体使用
2024-01-20 13:09:54
![](https://img.aspxhome.com/file/2023/9/117829_0s.jpg)
sql server实现递归查询的方法示例
2024-01-23 00:57:17
解决jupyter notebook启动后没有token的坑
2023-03-18 23:46:37
![](https://img.aspxhome.com/file/2023/3/86233_0s.png)
Python时间戳使用和相互转换详解
2023-01-22 08:14:28
Python中encode()方法的使用简介
2023-09-22 15:26:38
oracle调试存储过程的过程详解
2024-01-13 03:51:17
![](https://img.aspxhome.com/file/2023/8/64098_0s.png)
python使用cookie库操保存cookie详解
2022-09-24 09:33:58
python 引用传递和值传递详解(实参,形参)
2023-10-25 15:57:44
![](https://img.aspxhome.com/file/2023/7/127267_0s.jpg)
MySQL如何使用使用Xtrabackup进行备份和恢复
2024-01-24 14:45:49
![](https://img.aspxhome.com/file/2023/6/82256_0s.png)
vscode 配置eslint和prettier正确方法
2022-12-31 04:54:44
![](https://img.aspxhome.com/file/2023/4/114704_0s.png)
keras小技巧——获取某一个网络层的输出方式
2023-08-20 12:56:47
python定向爬取淘宝商品价格
2023-10-03 23:33:12
ORACLE数据库事务隔离级别介绍
2012-10-07 10:43:36
python Timer 类使用介绍
2022-09-02 18:36:37
GO语言中接口和接口型函数的具体使用
2023-06-18 09:08:40
960px下的黄金分割
2009-07-31 14:33:00
![](https://img.aspxhome.com/file/UploadPic/20097/31/498022_1248973274hhmt-19s.jpg)
详解Python中键盘鼠标的相关操作
2021-04-17 23:39:02
![](https://img.aspxhome.com/file/2023/2/88032_0s.png)
Python使用turtule画五角星的方法
2022-11-10 04:51:31
TypeScript中命名空间与模块化详情
2024-04-25 13:11:23
![](https://img.aspxhome.com/file/2023/5/135545_0s.png)
Python中dictionary items()系列函数的用法实例
2023-11-23 08:03:03