The ideal place for storing persistent PHP objects

Store the object temporarily in the database, but implement __sleep() and __wakeup() to avoid side effects.

Alternatively, implement the Serializable interface and prepare the data in its methods. There is no need to store NULL values.

Leave a Comment