Re: issues with __sleep() and __wakeup()
| From: | Richard Lynch | Date: | Wed, 01 Aug 2001 07:52:04 +0000 |
| Subject: | Re: issues with __sleep() and __wakeup() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60594@lists.php.net to get a copy of this message | ||
> 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...
> }
> function __sleep()
> {
According to the manual, this is supposed to return an array of the variable
names you want serialized.
return(array('svar'));
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 :-)