Hi there,
as far as I know there are no destructors in PHP. So what can I do when I want to get all objects serialized and stored in a session when PHP requests to destroy them after the script is ready? Can't I define a special class method for that? To invoke a special function at each page would maybe help, but it is surely not the elegant way.
there are no destructors.
You must do it explicitly.
you can use [man]serialize[/man]
http://php.net/register_shutdown_function
You can register a function that is executed when your script is finished. In this function, you could have the objects serialize themselves.