Re: possible bug (string equality to zero)?

From: Date: Thu, 11 Aug 2005 16:50:09 +0000
Subject: Re: possible bug (string equality to zero)?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220447@lists.php.net to get a copy of this message
No, Christopher, that is not a bug. As long as the var is empty, and if you try to compare with 0, or false, it will report true in the comparison because the variable does not contain anything, which will mean false for a boolean and 0 for a variable. If you are attempting to discover if a string contains data, use empty() instead. You can also check if the string is null or actual zero (0). Regards, Torgny Christopher J. Bottaro wrote: >Is it a bug that ($var == 0) is always true for any string $var? >

« previous php.general (#220447) next »