| Parameter | Details |
|---|---|
| value | The value to be serialized. serialize() handles all types, except the resource-type. You can even serialize() arrays that contain references to itself. Circular references inside the array/object you are serializing will also be stored. Any other reference will be lost. When serializing objects, PHP will attempt to call the member function __sleep() prior to serialization. This is to allow the object to do any last minute clean-up, etc. prior to being serialized. Likewise, when the object is restored using unserialize() the __wakeup() member function is called. Object's private members have the class name prepended to the member name; protected members have a '*' prepended to the member name. These prepended values have null bytes on either side. |
Serialization uses following string structures:
[..]are placeholders.
| Type | Structure |
|---|---|
| String | s:[size of string]:[value] |
| Integer | i:[value] |
| Double | d:[value] |
| Boolean | b:[value (true = 1 and false = 0)] |
| Null | N |
| Object | O:[object name size]:[object name]:[object size]:{[property name string definition]:[property value definition];(repeated for each property)} |
| Array | a:[size of array]:{[key definition];[value definition];(repeated for each key value pair)} |