RE: [PHP-GENERAL] Unsetting global variables within a function?

From: Date: Thu, 01 Jun 2000 16:33:59 +0000
Subject: RE: [PHP-GENERAL] Unsetting global variables within a function?
Groups: php.general 
Request: Send a blank email to php-general+get-840@lists.php.net to get a copy of this message
Assuming your using php4 global $date = $date = &GLOBALS["date"]; your actually creating a reference to the global $date variable. So when you use unset on it, only the reference is being unset not the actual GLOBAL. -Stewart -----Original Message----- From: Paul DuBois [mailto:paul@snake.net] Sent: 01 June 2000 17:18 To: php-general@lists.php.net Subject: [PHP-GENERAL] Unsetting global variables within a function? I have an HTML form. One of the form actions requires that I clear out all the current form variables so that I can present a new, empty form. I want to unset these variables from within a function. Suppose I have a variable named $date from the form. This does not appear to work: function xxx () { global $date; unset ($date); } On the other hand, this does work: function xxx () { unset ($GLOBALS["date"]); } Just curious why this is. -- Paul DuBois, paul@snake.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#840) next »