<?php class A implements Serializable { function __construct($o) { $this->o = $o; } function serialize() { return serialize([$this->o]); } function unserialize($s) { $this->o = unserialize($s)[0]; } } $o = new stdClass; $r = unserialize(serialize([new A($o), new A($o)])); var_dump($r[0]->o === $r[1]->o);
You have javascript disabled. You will not be able to edit any code.