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