Re: Serializing objects, using __sleep and __wakeup?
| From: | Teodor Cimpoesu | Date: | Fri, 07 Jul 2000 13:53:11 +0000 |
| Subject: | Re: Serializing objects, using __sleep and __wakeup? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23806@lists.php.net to get a copy of this message | ||
Hi David!
On Fri, 07 Jul 2000, David Eriksson wrote:
>
> I have a few classes in my CORBA extension, and I want them to work
> transparently with PHP:s session management, they need to be serializable.
>
> Right now I believe that value.obj.properties is serialized, but there I
> just store an index to a list of internal data... (like the COM extension)
>
> I looked in ext/session/session.c and ext/standard/var.c and it seems like
> it is possible to make member functions called __sleep and __wakeup, which
> might be what I need.
>
> Can anyone explain how these work? I have not been able to find any docs
> or examples that explain this.
I remember Thies(?) posting an example of how they work.
Also another cool function is __string_value, something like
toString() is Java or JavaScript.
I played with it:
http://teo.digiro.net/devel/php/libdev/test/test_serwddx.phps
http://teo.digiro.net/devel/php/libdev/test/test_serial.phps
-- teodor