Hi!

> I’ll refer again to the above documentation:
> 
> "A variable is considered to be null if […] it has been unset().”

You are confusing two things.

1. The variable has value of null.
2. The variable does not exist, so when you try to get its value,
there's nothing to give you, but we don't want to produce fatal error
because of such trifle, so we substitute null instead.

These are two different situations, but in many cases, for practical
reasons, they are treated similarly because for majority of the use
cases they are similar for the user and make

> This one can’t be chalked up to sloppy writing. Here, something is just
> plain wrong.

I'm afraid the something which is wrong here is your understanding of
how undefined variables and nulls work :) "Considered to" is not the
same as "is". It's a substitution, not identity.

> variable is null, but one can’t easily tell if a variable is just not
> defined. That strikes me as an oversight especially given the fact that
> one can use unset() to make a variable once again undefined. Put another

That's because in most of the use cases in practice there's no useable
difference between the two. You *can* distinguish between the two (and
in this thread there were a number of ways mentioned) but not with isset().

> That happens in the end, but not before an error is thrown. I want a
> one-keyword way to know that a variable is not defined without having to
> trip an error.

Not every use case deserves keyword in the language. This one doesn't
seem to be the one that does. However, if you think I am wrong you are
free to write an RFC and put it to a vote.

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to