-
persisting objects
I'm sure the answer to this is use a session but I thought I would check.
I have a class that I want to use in a lot of my pages but would like to instantiate it once and use it reapetedly. Is there any way to do this other than a session variable.
Thanks
-
That or serialize() the class, store it in a database, then unserialize() it when you get it back.
Only ways I can think of :)
-
The class in question is a database connection class which would be needed on most pages (information I omitted in the original post).
If I haven't got a current connection to mysql then I can't read to or write to the database.
-
PHP has the session-independent database connection pooling I think, it would be more efficient than sessions.