RE: [PHP4BETA] lates libzend update did bad things

From: Date: Fri, 03 Sep 1999 14:45:30 +0000
Subject: RE: [PHP4BETA] lates libzend update did bad things
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-4043@lists.php.net to get a copy of this message
At 16:36 03/09/99 , Samuel Liddicott wrote:
Yes. unset($var) leaves no trace of $var. Assigning $var with anything, regardless of what you're assigning it with, $undefined_var included, means $var is intact, and contains some sort of a value. It would contain that so called undefined value, but it would mean that each and every piece of code that may handle $var must be aware that in case it contains that undefined value, it must behave differently. In php4, what would be returned if $url was not in $urls[] ? Surely the undefined value?
No. It would return an empty string (true for PHP 3.0 as well). The PHP behavior for this is simple. The value of an undefined variable is an empty string. You're allowed to rely on that, and many PHP programmers do (I personally don't like it and prefer turning E_NOTICES on to avoid it, but that's the published behavior). Thus, when you return $foo (or $foo["bar"], doesn't matter) which doesn't exist, or what you assign it, or in other words - whenever you use it outside isset(), the value of $foo is an empty string. It's always been that way, and there's no intention to change it... What has changed from PHP 3.0 is that unset() is now much more powerful, and can successfully undefine variables always, without needing to use hooks and tricks as the PHP 3.0 version had to. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.il

« previous php.version4 (#4043) next »