惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - 斌哥tobin

Go工程选择开源分库分表中间件可用性测试 Golang解决fatal error: all goroutines are asleep - deadlock! Laravel Model查询结果的3种存储格式内存占用对比 Laravel配置Route调用artisan 研究微信红包分配算法之Golang版 解决IDEA提示Untrusted Server's certificate 证书不可用( Server's certificate is not trusted ) select * 和 select 字段的速度对比 Docker镜像拉取失败或超时的解决办法:添加国内镜像 php连接docker运行的mysql,显示(HY000/2002): Connection refused的解决办法 VirtualBox虚拟CentOS7共享文件夹 Windows7用VirtualBox虚拟Ubuntu共享文件夹的终极方式 PhpStorm添加PHP代码规范检查CodeSniffer(phpcs)和PHP代码静态分析工具Mess Detector(phpmd) php计算字符串长度 mac brew 安装php扩展报错:parent directory is world writable but not sticky Mac iTerm2命令行快捷操作 System.Web.AspNetHostingPermission 类型的权限已失败 优化phpstorm运行卡顿问题! composer [ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist - 斌哥tobin nginx1.8安装nginx_concat_module及400错误解决办法
php的三个常用判断函数
斌哥tobin · 2017-02-27 · via 博客园 - 斌哥tobin
<?php
error_reporting(E_ERROR);
$a;
$b = false;
$c = '';
$d = 0;
$e = null;
$f = array();

echo 'empty', PHP_EOL;
echo var_export(empty($a), 1), ',';
echo var_export(empty($b), 1), ',';
echo var_export(empty($c), 1), ',';
echo var_export(empty($d), 1), ',';
echo var_export(empty($e), 1), ',';
echo var_export(empty($f), 1), ',';
echo PHP_EOL;
echo 'isset', PHP_EOL;

echo var_export(isset($a), 1), ',';
echo var_export(isset($b), 1), ',';
echo var_export(isset($c), 1), ',';
echo var_export(isset($d), 1), ',';
echo var_export(isset($e), 1), ',';
echo var_export(isset($f), 1), ',';
echo PHP_EOL;
echo 'is_null', PHP_EOL;

echo var_export(is_null($a), 1), ',';
echo var_export(is_null($b), 1), ',';
echo var_export(is_null($c), 1), ',';
echo var_export(is_null($d), 1), ',';
echo var_export(is_null($e), 1), ',';
echo var_export(is_null($f), 1), ',';

结果:

empty
true,true,true,true,true,true,


isset
false,true,true,true,false,true,


is_null
true,false,false,false,true,false,

is_null($a) 时会报一个Notice告警:PHP Notice:  Undefined variable: a

设置 error_reporting(E_ERROR);屏蔽这个告警