|
Posted by Chung Leong on 07/17/06 22:04
Bent Stigsen wrote:
> It's quite clearly stated in the manual, no problem there. I just
> don't understand the choice of behavior.
>
> It is the concept of "isset", which I like to take literally.
> When I set the variable to null, causing the variable to appear in
> $GLOBALS, why should "isset" return false?
>
> I understand the behavior, not the choice.
Part of the reason is the way the global and static keyword was
implemented. These are operators, not declarations. When you use them
on variables they create entries in the current symbol table. Thus if
isset() behaves as you described, it'll always return true in the
following:
<?
function bobo() {
static $the_clown;
if(isset($the_clown)) {
}
}
?>
which wouldn't be rather unintuitive, since you never actually set the
variable.
Navigation:
[Reply to this message]
|