From the php
manual
Note, however, that references inside arrays are potentially
dangerous. Doing a normal (not by reference) assignment with a
reference on the right side does not turn the left side into a
reference, but references inside arrays are preserved in these normal
assignments. This also applies to function calls where the array is
passed by value. Example:
/* Assignment of array variables */
$arr = array(1);
$a =& $arr[0]; //$a and $arr[0] are in the same reference set
$arr2 = $arr; //not an assignment-by-reference!
$arr2[0]++;
/* $a == 2, $arr == array(2) */
/* The contents of $arr are changed even though it's not a reference! */
In, your case, you have
$a=array(1 => "A");
$b=&$a[1]; // this line is making it as ref (ref preserved)
$c=$a;
$c[1]="C";
echo $a[1];
If you write
$b=&$a; // then it's normal as expected.
Then this will result A
not C
echo $a[1]; // A
Read more on php.net and (it's also confusing to me and can't explain it more than this, honestly!)