Ilia Alshanetsky wrote:
Do we really need this function? I see 2 ways of 'implementing' this functionality in PHP without having to add another function. For example:I for one would like to see something like variable_exists(), as I am very annoyed with
(isset($var) || is_null($var)) or gettype($var).
Ilia
the logic of isset() returning false if the variable exists and has a value of null.
The name of the function in this case doesn't not fit the logic for isset(). The variable does exist and it IS in fact set, the value just so happens to be null.
It's just that 'null' is not a value.
The way PHP treats null value is identical to that of non existent values, which is precisely why isset() behaves the way that it does. I'm not sure what the logic is behind Ilia's alternatives, they won't behave any differently whether $var exists and is null, or whether it doesn't exist at all, and it's intentional.
Zeev
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php