|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-11-27 09:32 UTC] alex_boyer at hotmail dot com
[2002-12-09 06:57 UTC] andi@php.net
[2004-04-08 20:06 UTC] sniper@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 22:00:01 2025 UTC |
I try to keep reference on all instances of a class. Even, unserialized one. <?php class A { var $x=1; function __wakeup(){ $GLOBALS['ref'] =& $this; } } function set(){ //Serialize information $a =& new A(); $a->x=2; $data = serialize($a); //Unserialize $b =& unserialize($data); // i try without '&' $result= $b === $GLOBALS['ref']; // $result == true; echo "VALUE IN SET: {$b->x} \n"; // Echo 2 } set(); echo "VALUE OUT SET: {$GLOBALS['ref']->x}\n"; //echo nothing, $GLOBALS['ref'] is now NULL ! ?> I have read all docs, my eyes burns me but i really cannot understand. I look in database too.