unset and global behavior problems.
[email protected] ("Andrew A. Neuschwander")
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <[email protected]> |
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.
[email protected]
[email protected]