假设代码如下:
$a = [1,2];
$b = &$a; // $b holds reference to $a
$b[] = 3; // so this makes $a to {1,2,3}
$b = $a; // $b now holds COPY of $a (not reference)
$b[] = 4; // so $a must be the same {1,2,3}
var_dump($a); // but it isn't - $a is {1,2,3,4}
所以某种语句$b = $a;
并没有按原样分配$ a数组的新副本,而只是使用它的引用。那是为什么?