jon*_*ohn 5 php conditional-statements
这两个语句是否完全相同,$thing可以是任何类型的?
$thing
if (!empty($thing)) { // do stuff } if ($thing) { // do stuff }
我知道我可以尝试一下,但我不确定我会抓住所有边缘情况......我担心在某些情况下它们会执行相同但不是全部.
MrG*_*ass 4
如果$thing未定义,则将if ($thing)抛出(非致命)错误,同时if (!empty($thing))返回 false。
if ($thing)
if (!empty($thing))
请参阅PHP 文档中的empty() 。
归档时间:
13 年 前
查看次数:
171 次
最近记录: