Here it works (I don't know why):

$a = array('a' => 1) $a['a'] = &$a['b']; 

In this case, either a reference to $a['a'] , or $a['a'] o_O itself is written to $ a ['b']. Ampersand should be removed — that's all, an error of an undeclared index b .

Why is this so?

  • one
    In fact, in $a reference to NULL ([ ideone.com ] [1]), and when you remove an ampersand, the interpreter tries to access a cell that does not exist, hence the error. [1]: ideone.com/NCb9AW - Opalosolo
  • In a more detailed example, not nulls o_O were stored there - Arc
  • @Arc, & $ a ['b'] is a reference to the b element in array a. Element b you do not exist. - mountpoint

0