note 5415 deleted from unset by danbeck
| From: | danbeck@php.net | Date: | Wed, 20 Sep 2000 09:16:03 +0000 |
| Subject: | note 5415 deleted from unset by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-5212@lists.php.net to get a copy of this message | ||
More on PHP 4 compatability:
unset() in PHP4 removes the symbol from the symbol table.
This can be confusing when using PASS BY REFERENCE, global, or static variables. For instance, if
you pass a variable by reference to a function like this:
<pre>
function foo(&$bar) {
unset($bar);
$bar = "blah";
}
</pre>
$bar will NOT be set in the calling environment, like in would be in PHP3 because the symbol $bar
was removed from the calling environment's symobol table with unset(). Therefore, when setting
$bar to "blah", it will only be set in the environment of the function foo().