serialize

string serialize(mixed data) 

Converts data into an easily-storable and transportable format.

Returns:

String representation of the data

Description:

serialize() converts a variable or value into a format that can easily be stored as plain text and then restored to its original value using unserialize(). Both the variable’s type and value are stored.

Any variable type can be serialized, except resource pointers. Also, only an object’s member variables are serialized—the object’s methods are discarded during the process.

Availability:

UNIX, Windows

Version:

3.0.5+, 4+

Examples:

Basic use of serialize()
 $quote = <<<_END_QUOTE_ "Almost at once the No. 37 Penpoint returned to the Featureless Expanse."<br /> &nbsp;&nbsp;&nbsp;&nbsp;An ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.