84
69

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP 空判定メソッドの返り値 empty, isset, is_null 備忘録

Posted at

空判定の返り値早見表 (@覚えられない)

if($var) isset($var) empty($var) is_null($var)
$var=1 TRUE TRUE FALSE FALSE
$var="" FALSE TRUE TRUE FALSE
$var="0" FALSE TRUE TRUE FALSE
$var=0 FALSE TRUE TRUE FALSE
$var=NULL FALSE FALSE TRUE TRUE
$var FALSE FALSE TRUE TRUE
$var=[] FALSE TRUE TRUE FALSE
$var=[1] TRUE TRUE FALSE FALSE
84
69
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
84
69

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?