|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-12-01 06:41 UTC] philip@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ when comparing empty string, empty array, FALSE, integer 0 with NULL, comparison always returns TRUE. but imho empty string, FALSE or 0 are still any values, instead of NULL is "no" value. of course, i can use === but documentation says "equals" - isn't is little bit confusing to check also type, when NULL has no type? in whatever programming lanugage, NULL is NULL and not anything else, don't know, why PHP behaves differently Reproduce code: --------------- // should be array(), 0, FALSE etc. instead of '' if ('' == NULL) { echo 'hey dummy, empty string should not be NULL!'; } else { echo 'yeah, empty string is not NULL at all!'; } Expected result: ---------------- yeah, empty string is not NULL at all! Actual result: -------------- hey dummy, empty string should not be NULL!