|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-12-17 12:00 UTC] milan at acmilan dot hu
[2002-12-22 16:29 UTC] milan at acmilan dot hu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 12:00:01 2025 UTC |
<?PHP class A { var $Text; var $Parent; function A(&$parent, $s) { $this->Text = $s; $this->Parent = &$parent; } } class B { var $Child; function B() { $this->Child =& new A($this, "Hello"); } } class C { var $Child; function C() { $this->Child = new A($this, "Hello"); } } echo "<pre>\n\n"; $b= new B(); $s = serialize($b); echo "$s\n" . strlen($s) . "\n"; $s = serialize(&$b); echo "$s\n" . strlen($s) . "\n"; $b=& new B(); $s = serialize($b); echo "$s\n" . strlen($s) . "\n"; $s = serialize(&$b); echo "$s\n" . strlen($s) . "\n"; $c= new C(); $s = serialize($c); echo "$s\n" . strlen($s) . "\n"; $c=& new C(); $s = serialize(&$c); echo "$s\n" . strlen($s) . "\n"; echo "</pre>"; ?> -------cut----------- hello! i tried this script both on windows and linux with PHP 4.2.3 installed. I saw, that the serialized code could be highly redundant, depending on serializing the object or it's refference. there's also a problem around the new constructor, or i guess, the problem might be at copying objects with the '=' operator...