4.2. PHPlot Object Serialization

This section contains information about serializing and unserializing a PHPlot object.

Serializing a PHP variable, array, or object with the PHP function serialize() generates a string representation of the value which can be stored or transmitted. Unserialization with the PHP function unserialize() re-creates the variable, array, or object from the string representation.

Starting with PHPlot-5.8.0, PHPlot objects can be serialized and unserialized, subject to these limitations:

Here is an example of serializing a PHPlot object:

require_once 'phplot.php';
$plot = new PHPlot(800, 600);
... // Configure the PHPlot object: Set plot type, data values, etc.
// Do not use DrawGraph (yet)
$str = serialize($plot);

The corresponding unserialization looks like this:

require_once 'phplot.php';
$newplot = unserialize($str);
// You can do additional plot setup here if desired.
$newplot->DrawGraph(); // Draw it

SourceForge.net Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.