DNS server, DNS service

A.N.C.H.I.H.O.O.N

[PHP] isset, is_null, ===null, ==null, empty 본문

웹&컴퓨팅

[PHP] isset, is_null, ===null, ==null, empty

chihoon, An. (A.K.A 슈퍼스타) x2chi 2015.06.09 13:39
크리에이티브 커먼즈 라이선스
Creative Commons License

As you can see in the following table empty($foo) is equivalent to $foo==null and is_null($foo) has the same function of $foo===null. The table also show some tricky values regarding null comparison.

Personally, I never use empty() and is_null() functions.

        isset  is_null ===null  ==null  empty
 null |   F   |   T   |   T   |   T   |   T   |
unset |   F   |   T   |   T   |   T   |   T   |
  ""  |   T   |   F   |   F   |   T   |   T   |
  []  |   T   |   F   |   F   |   T   |   T   |
    0 |   T   |   F   |   F   |   T   |   T   |
false |   T   |   F   |   F   |   T   |   T   |
 true |   T   |   F   |   F   |   F   |   F   |
    1 |   T   |   F   |   F   |   F   |   F   |
   \0 |   T   |   F   |   F   |   F   |   F   |

 

 

 

 

 

http://stackoverflow.com/a/15607549

신고
0 Comments
댓글쓰기 폼