I am a bit confused with the following code example. I would guess that the second assignment $ins = new A(); would override the previous $ins reference.
I also don't understand the #1, #2, neither the (1),(1) in the var_dump output, I would expect at least (0),(0).
Thanks in advance
class A{
public $var = 2;
}
$ins = new A();
$aux = &$ins;
$ins->var = 3;
var_dump($aux);
echo '<br>';
$ins = new A();
$ins->var = 5;
var_dump($aux);
prints
object(A)#1 (1) { ["var"]=> int(3) }
object(A)#2 (1) { ["var"]=> int(5) }