Re: PHP 4.0 Bug #6076 Updated: NULL is isset in function arguments

From: Date: Thu, 10 Aug 2000 09:39:09 +0000
Subject: Re: PHP 4.0 Bug #6076 Updated: NULL is isset in function arguments
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-28402@lists.php.net to get a copy of this message
* "Bug Database" <php-dev@lists.php.net> wrote: | Yes, that's how it should work. Default argument | is used only when no argument is given. And isset() | check if variable was set. Value to which it was | set is not important. Then one simple question: How can i distinguish between 'not set' and 'set to NULL' in PHP as the interpiler can? One example: <?php if ($a === NULL) print 'oops'; # If NULL is a value, as you said above, the script MUST # NOT print 'oops' ('no value' can't be a value so it # can't be equal to the value NULL) if (isset($a)) print "no value but set"; # $a is set to no value -> the script MUST NOT print 'no # value but set'. $a = NULL; if (isset($a)) print "value NULL, isset"; # $a is set to NULL, the script MUST print # 'value NULL, isset' ?> The scripts output is 'oops'. This means the following: An unset variable is equal to NULL. An unset variable is 'not set' A variable set to NULL is 'not set', too A variable set to NULL as an argument to a function is 'set'. Something goes wrong here, don't you think? Maybe you should introduce a 'undef' value for 'undefined' values. regards, -- Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://www.bjoernsworld.de am Badedeich 7 · Telefon: +49(0)4667/981ASK · http://bjoern.hoehrmann.de 25899 Dagebüll · PGP KeyID: 0xA4357E78 · http://learn.to/quote <---

« previous php.dev (#28402) next »