RE: [PHP] Re: issues with __sleep() and __wakeup()

From: Date: Wed, 01 Aug 2001 14:21:12 +0000
Subject: RE: [PHP] Re: issues with __sleep() and __wakeup()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60655@lists.php.net to get a copy of this message
> -----Original Message----- > From: Richard Lynch [mailto:ceo@l-i-e.com] > Sent: Wednesday, August 01, 2001 3:52 AM > To: php-general@lists.php.net > Subject: [PHP] Re: issues with __sleep() and __wakeup() > > > > class Scott { > > var $svar = array(); // free-form hash for whatever data > > function Scott( ) > > { > > return $this; > > Like, I don't think you're supposed to return $this from your constructor... thanks for letting me know, it's an outdated habit from perl... > > } > > function __sleep() > > { > > According to the manual, this is supposed to return an array of the variable > names you want serialized. > > return(array('svar')); so it seems that there's no way to specify *all* my variables without naming them explicitly in __sleep() ? > in this case, I think, would be what you want... > > > } > > function __wakeup() > > { > > $this->svar['sleep'] = "I am waking up"; > > } > > }// end class > > Once you get it working, post your sample to the User Contributed notes > please :-) i definately will. thanks for the suggestions everyone.

« previous php.general (#60655) next »