RE: [PHP] session_register in a class

From: Date: Thu, 10 Aug 2000 21:31:57 +0000
Subject: RE: [PHP] session_register in a class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-11226@lists.php.net to get a copy of this message
You would need to register an instance of the class like this. This is due to the natur of session_register, which register the global variable, by the name you provide. Therefore you would not be able to register an member of a class withour registering the hole instance of the class. $var = new myClass; session_register("var"); Regards, Lars -----Original Message----- From: The Captain [mailto:rob@siliconcarne.net] Sent: 10. august 2000 23:18 To: php-general@lists.php.net Subject: [PHP] session_register in a class I was looking at the documentation for the session_register() function. Am I correct here: You would type in session_register('foo'); and puts the value of $foo in your session, and it available as $foo in other php files in the same session. I want to register session variables in a method of a class. This is a brief example of the class i'm using: class myClass { var $prop1 = "foo"; var $prop2 = "bar"; function createSession() { session_start(); session_register('prop1'); session_register('prop2'); /* i want the above to have the values of $this->prop1 and $this->prop2 */ } } Any ideas on this? Cheers, The Captain -- 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 (#11226) next »