note 26502 deleted from function.unset by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 02:29:04 +0000 |
| Subject: | note 26502 deleted from function.unset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58491@lists.php.net to get a copy of this message | ||
Note Submitter: alabonte@pt.com
----
PHP3 to PHP4 unset issues.
I was using unset freely in PHP3, to clear the contents of variables.
and in PHP3, it didn't destroy the variable, it simply cleared its current contents.
function foo(&$bar){
unset($bar);
$bar = "new value";
}
foo($bar)
echo $bar;
//IN PHP3 will print "new value"
//IN PHP4 will print "" because the variable was never given a value.
I took me forever to figure out why my functions weren't populating my variables... Learn from
my mistake.