<?php
class A {
protected $x;
public function __construct()
{
$this->reset();
}
public function getX()
{
return $this->x;
}
public function reset()
{
$this->x = new \DateTimeImmutable();
}
}
$a = new A();
$test = $a->getX();
echo spl_object_hash($test) . "\n";
$a->reset();
echo spl_object_hash($test);