|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-10-26 06:42 UTC] joey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
The following code fragment terminates the script: $id = "0"; if ( empty ($id) ) { die ("FATAL: need unique ID number"); } I would have expected, that empty ("0") is always FALSE, because a string containing the character "0" is definitively not empty [I know that empty() expects a variable, not a constant as argument]. The expression if ( empty($var) ) ... seems to be identical to if ( !$var ) ... I strongly feel that empty() should not consider a string with a "0" content as empty. This functionality is already covered with "if ( !$var)". Heiner Steven