Re: Re: PHP 4.0 Bug #7478 Updated: empty() function does not work as expected
| From: | Joey Smith | Date: | Thu, 26 Oct 2000 16:19:48 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #7478 Updated: empty() function does not work as expected | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-36080@lists.php.net to get a copy of this message | ||
Heiner:
There are other ways to do this. strlen() comes to mind...
On Thu, 26 Oct 2000, Heiner Steven wrote the following to php-dev@lists.php...:
> joey wrote:
>
> > Here's what the manual has to say:
> > Returns false if var is set and has a non-empty or non-zero
> > value; true otherwise.
>
> > The only bug here is in your idea of what empty() means.
>
> Well, that was obvious in the first place ;-)
>
> PHP takes the Perl concept of assuming that after
>
> $var = "0"
>
> the variable is empty. In this context, empty() has no benefit, because
> it's functionality can be achived just by using "if ( !$var )".
>
> I showed a way of giving empty() an improved functionality that would
> provide PHP programmers with an easy way to determine an empty string
> (instead of a "string who's value is FALSE").
>
> Well, thank you for your immediate feedback on this problem.
>
> Heiner