-4
可能重複:
What's the difference between is_null($var) and ($var === null)?is_null VS ===空
是否有下面的代碼之間的任何差別:
if(is_null($x)) { ...
和
if($x===null) { ...
可能重複:
What's the difference between is_null($var) and ($var === null)?is_null VS ===空
是否有下面的代碼之間的任何差別:
if(is_null($x)) { ...
和
if($x===null) { ...
是的。 ==
是一個寬鬆的比較,這意味着不僅僅是NULL
將在第二個版本中產生true
。請參閱type comparison tables。
NULL並不意味着真/假,它意味着未知的值,所以在使用它時要小心! – Philip 2012-04-29 06:23:40
文檔不夠嗎? [閱讀評論](http://php.net/manual/en/function.is-null.php)和[谷歌似乎有很多關於這方面的結果 - 你可能也想考慮'===' !](http://hakre.wordpress.com/2011/03/29/php-is_null-vs-null/) – 2012-04-29 06:18:06
http://stackoverflow.com/questions/4662588/whats-the-difference-between-is -nullvar-and-var-null – 2012-04-29 06:21:11
這個問題不應該upvoted無用。許多確切的重複項已經存在 – 2012-04-29 06:21:45