Re: Re: PHP 4.0 Bug #8163 Updated: The string "0" tests true as empty()
| From: | Joey Smith | Date: | Fri, 08 Dec 2000 12:34:53 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #8163 Updated: The string "0" tests true as empty() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40554@lists.php.net to get a copy of this message | ||
On Fri, 8 Dec 2000, Jesper Juhl wrote the following to Bug Database :
>
> I am aware that the behaviour is exactely what's documented. But it just
> seems illogical to me that a string that actually contains a a char (even
> if that char happens to be "0") is interpreted as empty. Could you please
> explain why you find that functionality desireable?
>
I would prefer for my variables that are equal to zero to be
considered empty, whether they are being evaluated in a string context
or an integer context. I imagine that the Core developers feel the same
way, and hence the behavior of empty(). (Note: That is just a guess.)