Date: 05/30/98
- Next message: Rasmus Lerdorf: "Re: [PHP-DEV] Re: PHP3 once again - latest cvs-version [FIXED]"
- Previous message: sr: "[PHP-DEV] CVS update: php31/ext/odbc"
- In reply to: Jan Legenhausen: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Maybe reply: Rasmus Lerdorf: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Look at this:
>
> <?
> $test="";
>
> if (!$test) echo "False\n";
> if (empty($test)) echo "Empty!\n";
> if (isset($test)) echo "Is Set!\n";
> ?>
>
> Both functions empty() and isset() say TRUE - that's not the right
> thing, i guess.
Looks correct to me. $test is definitely set. ie. it has something
assigned to it. That something happens to be an empty string, but that is
still something, so isset() should return TRUE. Now, would you say that
the variable is empty? I would. An empty string is a pretty empty thing.
I would also expect the if(!$test) condition to evaluate to true and thus
printing FALSE here. So, the output I expect is:
False
Empty!
Is Set!
which is what happens. Which one of them do you not think is right?
Now, if you delete the $test=""; line completely and thus do not set it to
anything, I would expect the output to be:
False
Empty!
ie. the isset() condition will now be false. And that is what happens
again.
-Rasmus
- Next message: Rasmus Lerdorf: "Re: [PHP-DEV] Re: PHP3 once again - latest cvs-version [FIXED]"
- Previous message: sr: "[PHP-DEV] CVS update: php31/ext/odbc"
- In reply to: Jan Legenhausen: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Maybe reply: Rasmus Lerdorf: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

