Suppose I have a class called MyClass, with a member variable 'var'.And the following scenario:    echo '<pre>';$x=new MyClass;$y=new MyClass;$x->var=$y;echo 'Checking for $x->var===$y :'.($x->var===$y).PHP_EOL; // outputs 1$xs=serialize($x);$ys=serialize($y);$xsu=unserialize($xs);$ysu=unserialize($ys);echo 'Checking for $xsu->var===$ysu :'.($xsu->var===$ysu); //outputs nothingAfter serializing and de-serializing, the instances are different.The php runtime creates a different object and unserializes it. Should it not look at some object hash and return reference to the same object(after  de-serializing once).My qs. is what could be the drawbacks?Edit:I need identical references because of the following reason stated in 2 points: (Please correct if I am wrong)Objects can be serialized to disk in individual 1 file per object design. 1. Their file name could be returned as a reference string from the serialize() method. While deserializing, the file can be read from the disk and the object manipulated.2.So, now if I get identical references, any changes made to one would get reflected in the other, which could not be the case if the references are different. At the end, the single entity could be saved to the disk.
Different instances on deserialization of php objects?
php