Okay, so I have an object which can be accessed as:
$this -> users["u-###"]
where ### is replaced with the user's id number. For my specification, I will be accessing one specific user a lot, so I have assigned $this -> my to a specific user id ($this -> users["u-123"] for example).
This has worked for my needs up until I started editing the value assigned to one of these variables. For example:
$this -> users["u-123"] = 12;
does not automatically update $this -> my (it's assignment by value after all). Now, I want to use the & operator to fix this, but the way I assign this value is not very conventional. This is my method:
$this -> my = $this -> get_user(123);
where:
function get_user($id){
    /* some stuff here.... */
    $user = $this -> users["u-" . $id];
    return $user;
}
So I first thought, just update the assignment such that it looks like:
$this -> my = &$this -> get_user(123);
That didn't solve my problem. So I thought of also doing it within the function body as such:
function get_user($id){
    /* some stuff here.... */
    $user = &$this -> users["u-" . $id];
    return $user;
}
but this doesn't solve it either. Is there a way to achieve the reference assignment (so $this -> my and $this -> users["u-123"] both point to the same object with my get_user method?
 
     
    