All PHP types except for resources are serializable. Resources are a unique variable type that reference "external" sources, such as database connections.
Serialize / Unserialize
serialize() returns a string containing a byte-stream representation of any value that can be stored in PHP.
unserialize() can use this string to recreate the original variable values.
To serialize an object
To Unserialize an object
The Serializable interface
Classes that implement this interface no longer support
__wakeup(). The method serialize is called whenever an instance needs to be serialized. This does not invoke
__destruct()or has any other side effect unless programmed inside the method. When the data is
unserializedthe class is known and the appropriate
unserialize()method is called as a constructor instead of calling
__construct(). If you need to execute the standard constructor you may do so in the method.