Entry
How can I serialize a class in PHP?
Jun 28th, 1999 00:54
Nathan Wallace, Nathan Wallace
Take a look at the serialization code in PHPLIB:
http://phplib.shonline.de
The basic idea is to add two variables to every class:
classname
persistent_slots
The classname is what is says, persistent_slots is an array of the names
of the variables that need to be stored and retrieved when the class is
serialized.
If each class has these variables then a single serialize function can
be used to handle any object.