Date: 05/30/98
- Next message: Zeev Suraski: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Previous message: rasmus: "[PHP-DEV] CVS update: php31/ext/standard"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> int isset(mixed var);
>
> Returns true if var exists and has a value; false otherwise.
>
> int empty(mixed var);
>
> Returns false if var exists and has a value; true otherwise.
Ok, the documentation needs to be cleared up.
> So to conclude something :), you consider $a="" as having an value
> (isset()=True), but this value is empty (empty()=True). This behaviour
> means that strings can be set to be empty - other vars not (or am i
> wrong here?).
Nothing prevents you from doing something like:
$a = 15;
$a="";
ie. you can set a variable which used to hold an integer to the empty
string if you want to set it to "empty".
> I would suggest that a var hasn't to be considered as empty if it is
> declared/used once - regardless of their value (if it isn't the
> NULL-value - but i think there is no NULL or undeclare() in PHP3).
that is what isset() is for. If the variable has never been defined, then
isset() is false, and empty() is obviously also false.
> Hm, well, what about isset() now... i think this one is redundant, if
> empty() behaves as suggested.
Well, you are just turning empty() into isset() and thus losing the added
functionality of isset(). I like being able to tell the difference
between an empty variable and one that hasn't been set.
-Rasmus
- Next message: Zeev Suraski: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Previous message: rasmus: "[PHP-DEV] CVS update: php31/ext/standard"
- Next in thread: Zeev Suraski: "Re: [PHP-DEV] Bug #417: silent (?) change in variable's value behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

