Why the following
class AClass { public function __construct () { $this->prop = \"Hello\"; } public function &get () {
Your function func() needs to return a value and then it needs to assign to a variable what func() returned. See modified code below:
function func (&$ref) { $ref = &$ref->get(); return $ref; } $value = new AClass(); $new_value = func($value); var_dump( $new_value );