Hello, This is a reply to an e-mail that you wrote on Fri, 8 Aug 2003 at 14:18, lines prefixed by '>' were originally written by you. > I wish to pass a session variable into an object and have it available > as > an attribute. I have what I thought I needed below as a code segment > but > it douse no work. Has anybody got any idea how I should achieve this. > Ben > ....... > class Contacts{ > var $db; > array $SESSION; > function Contacts( $SESSION, $db ) { > $this->$SESSION = $SESSION; > $this->$db = $db; > }
That will work fine for reading from the variable, are you wanting to write to it and have the changes made available outside of your class? if so pass the array in by reference... function Contacts( &$SESSION, $db ) HTH, David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php