I find that the reference in the code below is confusing,
$a = 4;
$b = &$a;
var_dump($b);
$a = 10;
var_dump($b); // 10
$b = 100;
var_dump($a); // 100 but shouldn't it be 10?
Value of $b
is a reference to $a
and $a
is never a reference to $b
.
But why when I change the value of $b
. The value of $a
changes as well?