<?php
// $object1&$object2 are circle referencing
include_once "TSClass1.php";
include_once "SerializeManager.php";
$object1 = new TSClass1();
$object2 = new TSClass2();
$object1->var1 = "var1";
$object1->selfRef = $object1;
$object1->ref1 = $object2;
$object2->var2 = "var2";
$object2->setRef2($object1);
$str = SerializeManager::instance()->serializeObject($object1);
echo $str;
$newo = SerializeManager::instance()->unserializeObject($str);
//we get $str = C:8:"TSClass1":167:{1:a:2:{s:4:"var1";s:4:"var1";s:4:"ref1";C:8:"TSClass2":105:{2:a:2:{s:5:"_ref2";O:31:"ReferencedObjectSerializeMarker":1:{s:9:"objectKey";i:1;}s:4:"var2";s:4:"var2";}}}}
//and $newo is clone of $object1
?>
|