unset and global behavior problems.
| From: | Andrew A. Neuschwander | Date: | Fri, 19 May 2000 17:20:23 +0000 |
| Subject: | unset and global behavior problems. | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-15260@lists.php.net to get a copy of this message | ||
While working with the sourceforge php code, I can across this behavioral
difference between php 3 and 4. I wanted to know if this is an intended
change or not. The following script does very different things in the two
versions.
<?php
function thing() {
global $var;
unset($var);
$var = "Simpson";
}
$var = "Homer";
echo "$var<br>";
thing();
echo "$var<br>";
?>
In php3 the output is :
Homer
Simpson
In php4 the output is :
Homer
Homer
Is this change a bug or intentional?
Thanks,
Andrew N.
drender@bigsky.net
andrew@neuschwander.org