|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-09-28 07:50 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 14:00:01 2025 UTC |
Description: ------------ Expresions like (NULL == 0) or (NULL == '') evaluate to TRUE. I doubt whether it is correct, but unambiguously it is inconvenient. If a variable $Var = 0 or $Var = '' then empty($Var) returns TRUE, while isset($Var) returns TRUE too. From the other side when $Var = NULL isset($Var) returns FALSE. From this point empty string with 0 and NULL are not the same. Moreover manual says "Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant." So why NULL is equal to 0 and '' then? NULL means that variable has no value in php context or in other words is unset. So, I guess that check like $Var == NULL must has the same meaning like !isset($Var).